Le 04/08/2019 à 14:07, Johann Glaser a écrit :Hi James! Am Donnerstag, den 01.08.2019, 22:45 -0400 schrieb James Richters:I understand it better now, but I've been out of town and haven't been able to work on it. I'm not sure what is meant by installing development packages though.. I see libusb at https://libusb.info/ I see where to download that.. but I don't know about development packages? As for LibC, I'm not really sure where to find the proper package for that. I found http://gnuwin32.sourceforge.net/packages/libc.htm.bak but I'm not sure that is right, and again not sure about development package for that. I would really appreciate links to the exact packages I will need to use for Windows.I'm sorry that I can't help you here with these Windows-specific questions.Could somebody else please help out here? When you link to the dll, you can
remove the {$LINKLIB c}.
But for now I haven't been able to make it work with a static
link.Then I changed {$LINKLIB usb-1.0} to {$LINKLIB libusb-1.0}, and removed {$LINKLIB c} (I join the diff files) In this way, libusb-1.0.a is found by the compiler, but the dependencies of libusb-1.0.a on C runtime and several Windows system function are not fullfilled and you get these errors (I join them in file Compiler_output.txt) Some of them like WaitForSingleObject are provided by
Kernel32.dll but I don't know which lib from MinGW64 to use to
provide __imp_WaitForSingleObject.
|
src/examples/test1library.lpi | 122 +++++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 48 deletions(-) diff --git a/src/examples/test1library.lpi b/src/examples/test1library.lpi index 8de3135..42278b8 100644 --- a/src/examples/test1library.lpi +++ b/src/examples/test1library.lpi @@ -1,7 +1,7 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> - <Version Value="9"/> + <Version Value="11"/> <General> <Flags> <MainUnitHasCreateFormStatements Value="False"/> @@ -10,95 +10,110 @@ <MainUnit Value="0"/> <ResourceType Value="res"/> <UseXPManifest Value="True"/> - <Icon Value="0"/> - <ActiveWindowIndexAtStart Value="0"/> </General> <i18n> <EnableI18N LFM="False"/> </i18n> - <VersionInfo> - <StringTable ProductVersion=""/> - </VersionInfo> <BuildModes Count="1" Active="Default"> <Item1 Name="Default" Default="True"/> </BuildModes> <PublishOptions> <Version Value="2"/> - <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> - <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> </PublishOptions> <RunParams> <local> - <FormatVersion Value="1"/> <LaunchingApplication PathPlusParams="/usr/bin/rxvt-unicode -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> + <FormatVersion Value="2"/> + <Modes Count="1"> + <Mode0 Name="default"> + <local> + <LaunchingApplication PathPlusParams="/usr/bin/rxvt-unicode -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </Mode0> + </Modes> </RunParams> - <Units Count="3"> + <Units Count="6"> <Unit0> <Filename Value="test1library.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="Test1Library"/> - <IsVisibleTab Value="True"/> - <EditorIndex Value="0"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="1" Y="6"/> - <UsageCount Value="20"/> + <CursorPos Y="6"/> + <UsageCount Value="21"/> <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="../libusboop.pas"/> <UnitName Value="LibUsbOop"/> - <EditorIndex Value="2"/> - <WindowIndex Value="0"/> - <TopLine Value="95"/> - <CursorPos X="33" Y="112"/> + <EditorIndex Value="5"/> + <CursorPos Y="31"/> <UsageCount Value="10"/> <Loaded Value="True"/> </Unit1> <Unit2> <Filename Value="../libusb.pas"/> <UnitName Value="LibUsb"/> + <IsVisibleTab Value="True"/> <EditorIndex Value="1"/> - <WindowIndex Value="0"/> - <TopLine Value="495"/> - <CursorPos X="15" Y="509"/> + <TopLine Value="31"/> + <CursorPos X="13" Y="56"/> <UsageCount Value="10"/> <Loaded Value="True"/> </Unit2> + <Unit3> + <Filename Value="C:/lazarus/fpc/3.0.4/source/rtl/win64/windows.pp"/> + <EditorIndex Value="2"/> + <TopLine Value="42"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="C:/lazarus/fpc/3.0.4/source/rtl/win/wininc/base.inc"/> + <EditorIndex Value="4"/> + <TopLine Value="118"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit4> + <Unit5> + <Filename Value="C:/lazarus/fpc/3.0.4/source/rtl/win/wininc/func.inc"/> + <EditorIndex Value="3"/> + <TopLine Value="16"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit5> </Units> - <JumpHistory Count="26" HistoryIndex="25"> + <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="test1library.pas"/> - <Caret Line="5" Column="16" TopLine="1"/> + <Caret Line="5" Column="16"/> </Position1> <Position2> <Filename Value="test1library.pas"/> - <Caret Line="14" Column="27" TopLine="1"/> + <Caret Line="14" Column="27"/> </Position2> <Position3> <Filename Value="../libusboop.pas"/> - <Caret Line="8" Column="25" TopLine="1"/> + <Caret Line="8" Column="25"/> </Position3> <Position4> <Filename Value="test1library.pas"/> - <Caret Line="21" Column="62" TopLine="1"/> + <Caret Line="21" Column="62"/> </Position4> <Position5> <Filename Value="test1library.pas"/> - <Caret Line="26" Column="11" TopLine="1"/> + <Caret Line="26" Column="11"/> </Position5> <Position6> <Filename Value="test1library.pas"/> - <Caret Line="9" Column="24" TopLine="1"/> + <Caret Line="9" Column="24"/> </Position6> <Position7> <Filename Value="test1library.pas"/> - <Caret Line="28" Column="49" TopLine="1"/> + <Caret Line="28" Column="49"/> </Position7> <Position8> <Filename Value="test1library.pas"/> - <Caret Line="29" Column="50" TopLine="1"/> + <Caret Line="29" Column="50"/> </Position8> <Position9> <Filename Value="../libusboop.pas"/> @@ -106,27 +121,27 @@ </Position9> <Position10> <Filename Value="../libusboop.pas"/> - <Caret Line="170" Column="1" TopLine="147"/> + <Caret Line="170" TopLine="147"/> </Position10> <Position11> <Filename Value="../libusboop.pas"/> - <Caret Line="14" Column="3" TopLine="1"/> + <Caret Line="14" Column="3"/> </Position11> <Position12> <Filename Value="test1library.pas"/> - <Caret Line="29" Column="50" TopLine="1"/> + <Caret Line="29" Column="50"/> </Position12> <Position13> <Filename Value="test1library.pas"/> - <Caret Line="34" Column="19" TopLine="1"/> + <Caret Line="34" Column="19"/> </Position13> <Position14> <Filename Value="test1library.pas"/> - <Caret Line="30" Column="30" TopLine="1"/> + <Caret Line="30" Column="30"/> </Position14> <Position15> <Filename Value="test1library.pas"/> - <Caret Line="29" Column="44" TopLine="1"/> + <Caret Line="29" Column="44"/> </Position15> <Position16> <Filename Value="test1library.pas"/> @@ -138,7 +153,7 @@ </Position17> <Position18> <Filename Value="test1library.pas"/> - <Caret Line="7" Column="18" TopLine="1"/> + <Caret Line="7" Column="18"/> </Position18> <Position19> <Filename Value="../libusboop.pas"/> @@ -170,26 +185,37 @@ </Position25> <Position26> <Filename Value="test1library.pas"/> - <Caret Line="61" Column="1" TopLine="14"/> + <Caret Line="61" TopLine="14"/> </Position26> + <Position27> + <Filename Value="../libusb.pas"/> + <Caret Line="509" Column="15" TopLine="225"/> + </Position27> + <Position28> + <Filename Value="../libusboop.pas"/> + <Caret Line="112" Column="33" TopLine="95"/> + </Position28> + <Position29> + <Filename Value="../libusb.pas"/> + <Caret Line="56" Column="13" TopLine="31"/> + </Position29> + <Position30> + <Filename Value="C:/lazarus/fpc/3.0.4/source/rtl/win64/windows.pp"/> + <Caret TopLine="42"/> + </Position30> </JumpHistory> </ProjectOptions> <CompilerOptions> - <Version Value="9"/> + <Version Value="11"/> <Target> <Filename Value="test1library"/> </Target> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> + <Libraries Value="E:/03_travail/libusb/libusb-1.0.22/MinGW64/static/"/> <OtherUnitFiles Value=".."/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> </SearchPaths> - <Other> - <CompilerMessages> - <UseMsgFile Value="True"/> - </CompilerMessages> - <CompilerPath Value="$(CompPath)"/> - </Other> </CompilerOptions> <Debugging> <Exceptions Count="3">
src/libusboop.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libusboop.pas b/src/libusboop.pas index 6171c22..f8ab4ea 100644 --- a/src/libusboop.pas +++ b/src/libusboop.pas @@ -19,7 +19,8 @@ Unit LibUsbOop; {$macro on} {$ifdef windows} - {$define extdecl:=stdcall} + //{$define extdecl:=stdcall} + {$define extdecl:=cdecl} {$else} {$define extdecl:=cdecl} {$endif}
src/libusb.pas | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libusb.pas b/src/libusb.pas index 3210331..12df1a4 100644 --- a/src/libusb.pas +++ b/src/libusb.pas @@ -43,17 +43,22 @@ Unit LibUsb; {$macro on} {$ifdef windows} - {$define extdecl:=stdcall} + //{$define extdecl:=stdcall} + {$define extdecl:=cdecl} {$else} {$define extdecl:=cdecl} {$endif} Interface -Uses CTypes; +Uses + {$ifdef windows} + Windows, + {$endif} + CTypes; -{$LINKLIB c} -{$LINKLIB usb-1.0} +//{$LINKLIB c} +{$LINKLIB libusb-1.0} (* Automatically converted by H2Pas 1.0.0 from libusb.h
Hint: (11030) Start of reading config file C:\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.cfg Hint: (11031) End of reading config file C:\lazarus\fpc\3.0.4\bin\x86_64-win64\fpc.cfg Free Pascal Compiler version 3.0.4 [2019/02/03] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others (1002) Target OS: Win64 for x64 (3104) Compiling test1library.pas (3104) Compiling E:\03_travail\libusb\pas-libusb\src\libusb.pas E:\03_travail\libusb\pas-libusb\src\libusb.pas(56,5) Hint: (5023) Unit "windows" not used in LibUsb (3104) Compiling E:\03_travail\libusb\pas-libusb\src\libusboop.pas E:\03_travail\libusb\pas-libusb\src\libusboop.pas(275,5) Warning: (3018) Constructor should be public E:\03_travail\libusb\pas-libusb\src\libusboop.pas(545,11) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(545,10) Warning: (4056) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(546,11) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(564,72) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(852,29) Hint: (5057) Local variable "Status" does not seem to be initialized E:\03_travail\libusb\pas-libusb\src\libusboop.pas(922,18) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(922,17) Warning: (4056) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(923,18) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(937,45) Warning: (4056) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(1037,24) Hint: (4055) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(1037,23) Warning: (4056) Conversion between ordinals and pointers is not portable E:\03_travail\libusb\pas-libusb\src\libusboop.pas(1050,43) Warning: (4056) Conversion between ordinals and pointers is not portable (9015) Linking E:\03_travail\libusb\pas-libusb\src\examples\test1library.exe Error: Multiple defined symbol .refptr.usbi_backend Error: Multiple defined symbol .refptr.usbi_backend Error: Multiple defined symbol .refptr.usbi_default_context Error: Multiple defined symbol .refptr.INVALID_WINFD Error: Multiple defined symbol .refptr.pCancelIoEx Error: Undefined symbol: __imp_TlsGetValue Error: Undefined symbol: malloc Error: Undefined symbol: memcpy Error: Undefined symbol: __imp_EnterCriticalSection Error: Undefined symbol: __imp_LeaveCriticalSection Error: Undefined symbol: __imp_InitializeCriticalSection Error: Undefined symbol: __imp___iob_func Error: Undefined symbol: __imp_GetCurrentThreadId Error: Undefined symbol: __imp_DeleteCriticalSection Error: Undefined symbol: getenv Error: Undefined symbol: atoi Error: Undefined symbol: __ms_vsnprintf Error: Undefined symbol: calloc Error: Undefined symbol: fputs Error: Undefined symbol: fwrite Error: Undefined symbol: memmove Error: Undefined symbol: free Error: Undefined symbol: realloc Error: Undefined symbol: memset Error: Undefined symbol: __imp__errno Error: Undefined symbol: __imp_TlsSetValue Error: Undefined symbol: __imp_TryEnterCriticalSection Error: Undefined symbol: __imp_TlsAlloc Error: Undefined symbol: __imp_TlsFree Error: Undefined symbol: _assert Error: Undefined symbol: __imp_CreateEventA Error: Undefined symbol: __imp_WaitForSingleObject Error: Undefined symbol: __imp_CloseHandle Error: Undefined symbol: __imp_WaitForMultipleObjects Error: Undefined symbol: __imp_GetLastError Error: Undefined symbol: __imp_SetEvent Error: Undefined symbol: __imp_ResetEvent Error: Undefined symbol: __imp_SleepEx Error: Undefined symbol: __imp_TerminateThread Error: Undefined symbol: __imp_FreeLibrary Error: Undefined symbol: __imp_GetCurrentProcessId Error: Undefined symbol: __imp_CreateSemaphoreA Error: Undefined symbol: __imp_ReleaseSemaphore Error: Undefined symbol: __imp_GetVersionExA Error: Undefined symbol: __imp_VerSetConditionMask Error: Undefined symbol: __imp_VerifyVersionInfoA Error: Undefined symbol: __imp_FormatMessageA Error: Undefined symbol: __imp_GetSystemTimeAsFileTime Error: Undefined symbol: __imp_LoadLibraryA Error: Undefined symbol: __imp_GetProcAddress Fatal: (10026) There were 50 errors compiling module, stopping Fatal: (1018) Compilation aborted Error: C:\lazarus\fpc\3.0.4\bin\x86_64-win64\ppcx64.exe returned an error exitcode
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal