Libusb can be compiled with either calling convention - one just has to
be sure which one.
In https://github.com/Zaaphod/libusbxhid/blob/master/libusbx.pas (line
35), the windows calling convention is stdcall and that apparently works
for both 64 and 32 bit windows. So, James' libusb10 dlls use stdcall.
Also, I was under the impression that unlike linux, Windows apps would
compile regardless of the calling convention. Only when launching the
app and loading a dynamic library a wrong calling convention make things
blow up. Anyway, this is definitely something to look into.
On 8/17/19 11:46 AM, Jean SUZINEAU wrote:
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 ...
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
_______________________________________________________
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal