g++ and DLL's

C. Throne bluemonkey23@hotmail.com
Wed Apr 18 13:08:00 GMT 2001


Good Afternoon,

I have a DLL that I compiled under Cygwin (the source code was compiled with 
gcc and the library linked with g++).  Any executable that is 
compiled/linked with gcc is able to use this library just fine.  However 
when I try to compile/link with g++ I get a linker error (it can't find the 
data exported by the DLL).  To be more specific, I have a variable called 
foo in my dll which is exported via a .def file.

In my executable file I have:
extern __declspec(dllimport) int foo;
function()
{
  foo = 5;
}

This compiles/links/runs fine with gcc.  But I get a linker error about not 
being able to find foo when compiled with g++.  I ran the test program 
through the g++ preprocessor and it looks like __declspec(dllimport) is 
getting removed by the g++ preprocessor while it is getting turned into 
__attribute__(( dllimport )) with the gcc processor.

Any help on this would be greatly appreciated.

Thanks,
--Craig

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list