Forum > Packages and Libraries

Import libusb0_x86.dll or any other .dll in lazarus

(1/1)

vladapvo:
I've tried to import external dll to lazarus with {&LINKLIB libusb0_x86} but on compile says "not found". Im beginner in Lazarus but senior in VB.NET and i need only short explanation "how to import dll" in lazarus. In Lazarus wiki/help DYNAMIC LIBRARY i've found an owfull example which dont explains NOTHING,  so if there any REAL PROGRAMMER can explain this.

Best Regards

Vladimir

fabienwang:
Please read the topic here: http://www.lazarus.freepascal.org/index.php?topic=7747.msg36832#msg36832
or the last post on the same topic ( http://www.lazarus.freepascal.org/index.php/topic,7747.msg44837.html#msg44837 )

Regards,

ludob:
{$LINKLIB } requires a library to link against. That is typically a file with extension .a or .lib. Hence the not found. Specify lib\gcc\libusb.a in the libusb-win32 directory.

libusb0_x86 is a dll which should be renamed to libusb0.dll when put in the windows\system32 directory. Please read libusb-win32-bin-README.txt in the bin directory.

http://wiki.freepascal.org/Lazarus/FPC_Libraries explains other ways of using external libraries.

Last but not least, a libusb unit has been created by Marko Medic : http://www.lazarus.freepascal.org/index.php/topic,11435.0.html. Here http://mcuprogramming.blogspot.com/2011/03/intro-to-delphi-lazarus-for-embeded.html you'll find a link to LIBUSB Test.zip that contains the unit and a test program. It is written for linux but it is a good start for windows.


Edit:
A delphi port can be found here: http://read.pudn.com/downloads109/sourcecode/embed/449084/PowerSwitch_DelphiSource/Demo-libUSB/LibUSB.pas__.htm
You'll need to add {$mode delphi} to the unit to get it compiled. It uses directly the dll, without a {$linklib }.

avra:
libusb already has Pascal translated headers:
http://www.lazarus.freepascal.org/index.php/topic,13000.msg67843.html#msg67843

Navigation

[0] Message Index

Go to full version