Search code examples
winapilinkerlinker-errorsraw-input

winapi RawInput and pre XP compilers, how to link?


I need to use RawInput api calls from under the old compiler which is pre xp (it is borland 5.5 specifically - and do not tell me to use other compiler it is out of question, I need to use it)

Ist headers winuser.h and user32.lib do not contain the raw input calls, never header and user32.lib from other compilers do. So it is achieveable to use such external rawinput .h definitions and link it against newest user32.lib?

I am not so much experienced in linker stuff. Definitions compile but I do have unresolved externals at link

Error: Unresolved external '__stdcall GetRawInputDeviceList (tagRAWINPUTDEVICELIST *, unsigned int *, unsigned int)' referenced from C \CODE2\PROGRAM\MAIN.OBJ

Error: Unresolved external '__stdcall RegisterRawInputDevices(const tagRAWINPUTDEVICE *, unsigned int, unsigned int)' referenced from C:\CODE2\PROGRAM\MAIN.OBJ

substitution of old user32.lib with new user32.lib seem to give no effect (even renaming it out seem to has no effect, and it seems like compiler do not touch user32.lib at all (?)

How to make it work, much tnx for advice how to resolve this (and to not tell me i need newer compiler, i need to do it with this old)

(fire)

// edit : fixed my mistake typo winuser.lib to user32.lib (i meant user32.lib)


Solution

  • When you need to call APIs which do exist on some Windows platforms and not on other ones, then you must NOT bind to the associated LIB statically but dynamically (using LoadLibrary and GetProcAddress). Another mechanism would be to use Delay-loaded Libraries.