From: Dan S. <dan...@ad...> - 2005-08-16 00:21:25
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <pre>Hello, I searched the archives before posting this but didn't find an exact match so I apologize in advance if this has been addressed ad-nauseum. Here goes: I work on a project that releases dynamic shared libraries as a product. We release on a bunch of Unix systems and Windows. I am attempting to fully automate our build/release process using autoconf/automake/libtool and would like to use g++ throughout the process (easier for libtool) and convert to a DLL at the end that can be linked into a Visual Studio EXE. My problem is that all examples I find are 'C', not 'C++'. I am able to create a DLL fine (' depends.exe' can read it), but the symbols are mangled different. For example, I have a class 'foo' as such: #ifdef WIN32 # ifdef FOO_DLL # define FOO_EXPORT __declspec(dllexport) # else # define FOO_EXPORT # endif #else # define FOO_EXPORT #endif class FOO_EXPORT foo { public: foo(); virtual ~foo(); }; I compile: g++ -c foo.cpp -DWIN32 -DFOO_DLL dlltool -e exports.o -l foo.lib -z foo.def foo.o g++ -shared -o foo.dll foo.o exports.o I then use it: #include "foo.h" int main() { foo f; } cl.exe main.cpp foo.lib And I get errors for class 'foo' during the link. This is because 'foo.dll' has its default constructor mangled as: <a href="http://webmail.adelphia.net/webedge/do/mail/message/mailto?to=_ZN3foo%401EV">_ZN3foo@1EV</a> But the Visual Studio linker is looking for: ??1foo@@<a href="http://webmail.adelphia.net/webedge/do/mail/message/mailto?to=UAE%40XZ">UAE@XZ</a> So, can I get from here to there? Is it at all possible to create a C++ DLL using g++ and use it (transparently) within Visual Studio? Thanks Dan</pre> </body> </html> |