[fpc-pascal] USB Human Interface Devices

Jean SUZINEAU Jean.Suzineau at wanadoo.fr
Sat Aug 17 17:46:50 CEST 2019


Le 17/08/2019 à 17:10, Stefan V. Pantazi a écrit :
> The obvious first thing to make sure is that the calling convention 
> matches the library for the platform. I see that in 
> https://github.com/Zaaphod/pas-libusb/blob/Hack/src/libusb.pas 9line 46)
> the calling convention on Windows is cdecl (the stdcall is commented 
> out). In libusbxhid, if I remember correctly, the calling convention 
> for windows dlls is set to stdcall.
Yes it's curious.

Usually with Microsoft dlls from the Windows API, you use stdcall. Here 
with stdcall I get an error "Import library not found  for  libusb-1.0".

So I commented out the stcall changed it to cdecl.

This allows to compile without errors and test1library.pas works without 
error, it seems cdecl is the right calling convention for libusb-1.0.

> One other thing is that debugging is much more tedious without an 
> integrated debugger that allows you to step through each line before 
> you can see which function call blows up with a segfault.
James works on the command line but fp.exe seems to integrate gdb.exe 
the same way that lazarus does, you nearly have the same shortcuts keys 
for debugging between Turbo Pascal 5.5, fp.exe and lazarus ...


More information about the fpc-pascal mailing list