0

I'm trying to use a third party DLL (I'm compiling using MinGW) but I'm facing some troubles. First of all, the DLL exports undecorated names, but the declaration of the functions seen in the header files contain "__stdcall". Appart of that, I'm using C++, but I've sorrounded the include with 'extern "C"'.

The error:

undefined reference to `Play_Stop@4'

I've tried to link directly to the DLL, as G++ is theorically capable of doing that, but I got some "undefined reference"s.

Then I tried to generate a .def file, using gendef (gendef theirDLL.dll) and later I used dlltool to generate an import lib: dlltool -k --no-leading-underscore -d theirDLL.def -D theirDLL.dll -l theirDLL.a. Note that I used --no-leading-underscore as I observed with nm that all the functions were preceeded by one underscore, which was causing troubles.

However, even doing all of that, I don't get it to link properly. Any ideas?

I've checked that the linker founds the static library.

The function declaration in header file:

BOOL __stdcall Play_Stop(LONG nPort);

The include directive:

extern "C"{
#include "PlaySDK.h"
}

The nm command output (theirDLL.a)

...
daazs00103.o:
00000000 b .bss
00000000 d .data
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00000000 i .idata$7
00000000 t .text
00000000 T Play_Stop@4
00000000 I __imp_Play_Stop@4
...

And the error:

undefined reference to `Play_Stop@4'

Thank you in advance!

Pablo
  • 1
  • 2

0 Answers0