News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Lib HID / HID API

Started by RKSJBeck, November 14, 2025, 11:57:39 PM

Previous topic - Next topic

RKSJBeck

I've been trying to use the latest HID API in both source files , I get a linker error, and a compiled DLL.  Obviously a good DLL would be the ticket, but I don't seem to able to get it to work either.  I'm really a noob when it comes to non-embedded code, so I know I'm missing something obvious.  I keep getting :
"POLINK: error: Unresolved external symbol '_hid_init@0' - referenced from 'C:\Users\James Beck\Documents\Pelles C Projects\LibHIDTest\output\main.obj'.
POLINK: fatal error: 1 unresolved external(s)."
Even though I have loaded the DLL and even put the "lib" file in the linker library list.
I have included the DLL and header files, can anyone get the thing to work?

TimoVJL

#1
Have to use __cdecl calling convention.

Also header modification may help
/* To be removed in v1.0 */
#ifndef HID_API_CALL
    #define HID_API_CALL /**< API call macro */
#endif
and define preprocessor symbol
HID_API_CALL=__cdeclor in source
#define HID_API_CALL __cdecl

HINT:
open import library with pope.exe or TLPEView to see import symbol
pFile    Data    Description    Value
000016FC    0008    Type    IMPORT_OBJECT_CODE
        Name Type    IMPORT_OBJECT_NAME_NO_PREFIX
        Symbol info:   
        Symbol Name    _hid_open
        Dll    hidapi.dll
        Name    hid_open
That _hid_open is cdecl symbol
May the source be with you