GCC Cygwin C++ DLL linking problem

S

Sam Tiny

I have a Windows LIB/DLL that I need to link my GCC program with. I have
followed all the instructions I could find: using pexports to create .def
file from the .dll and then using dlltool to create a .a library file from
the .def file. I've dumped the symbols from the .a and noticed each function
is appeded with an underscore (_). Note that a dump of the DLL does not have
underscores prefixed to the function names. Also, the .def doesn't have any
underscores prefixed to the function names. I have been completely unable to
link my program when compiled as C++ getting the "undefined reference to"
error for each function in the DLL, but I am able to compile and link as C
code. Any suggestions? Thanks for any help.
 
M

modemer

Either you have to recompile LIB/DLL with C++ compiler.
or use quote in your code like:
extern "C" {
#include "LIB/DLL.h"
}
 
S

Sam Tiny

That fixed it! Thanks a lot.

modemer said:
Either you have to recompile LIB/DLL with C++ compiler.
or use quote in your code like:
extern "C" {
#include "LIB/DLL.h"
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top