0

I currently use a 3rd party dll connected to Fortran without problems, and i have only the .dll and .lib files. The 3rd party developer states that it is possible to connect it to Fortran or C.

I'm trying to use eclipse+mingw32 C and connect to this dll.

I tried several solutions reported here on the forum, but I always find problems with "linker" or "undefined reference" to the 3rd party function. See the list: [1]: Compile to .dll with some undefined references with MinGW [2]: mingw32 g++ and stdcall @suffix [3]: undefined reference to ‘_imp__InitBizLib’

The MinGW C Linker error is "undefined reference to `__imp_FUNCTIONNAME'".

Error message: g++ -L"C:\temp\externalLib.lib" -o "test.exe" ./src/aaSampleCodes.o ./src/main.o
./src/main.o: In function main': C:\Source\Debug/../src/main.cpp:59: undefined reference to func1(double, double)' collect2.exe: error: ld returned 1 exit status mingw32-make: *** [makefile:47: test.exe] Error 1

Someone could help by describing the proper way (using eclipse+mingw32) to proceed with that connection?

  • Please [edit] your question and add moire details. Provide links to the solutions you tried or describe exactly what you tried. Show the corresponding linker command and the resulting error message. – Bodo Feb 15 '21 at 11:41
  • @Bodo see if it is better now :D – Raphael Pugliesi Feb 15 '21 at 11:53
  • You don't need to link DLLs statically, they are rather meant to be linked dynamically. Kind of why they are named Dynamic Link Libraries. So you usually communicate with them in run-time using `LoadLibrary` family of functions from the Windows API. – Lundin Feb 15 '21 at 12:57
  • @RaphaelPugliesi Please also show the linker command that prints the error message. Copy&paste the complete command and the complete error message. – Bodo Feb 15 '21 at 14:20
  • thank you all for your time, like i said, i already tried several ways, and got several errors. In my initial question I ask for help to know the proper way to do this. If you have how to exemplify I will be grateful! – Raphael Pugliesi Feb 15 '21 at 17:18

0 Answers0