From: Andrew B. <ab...@ee...> - 2001-05-31 03:16:17
|
I've built a DLL with a C++ class that defined an inline function, like so: class DLLDECL Foo { ... public:=20 int hello(); } inline Foo::hello() { return 6; } DLLDECL is __declspec(dllimport) or __declspec(dllexport) as appropriate. I compiled this into its .o, ar'd it into a .a, and then used Paul's a2dll utility (extremely handy, thanks!) to turn it into a DLL. Then, I create another file (george.cc) that #include's this class, along with the inline function definition. I compile and link that, but when I used a2dll to try to turn that into a DLL, I get a multiple definition error: hello() is defined twice, once in the import library for the DLL that a2dll created, and once in the george.cc file.=20 Looking in the import library for my first DLL, I see three definitions re: hello: I __imp___hello__C3Foo... I __nm__hello__C3Foo... T _hello__C3Foo... This last definition is the problem I think. Should this really be in the import library? I think that this definition causes the a2dll'ing of george.cc to fail, since I'm sure that its .o contains the inline'd definition of hello() as well. Is this a GCC bug (i'm using gcc 2.95.2-3 from the mingw.org web page) where inline functions that are inlined after the class definition are marked to be included in the import library, when they really shouldn't? Thanks, Andrew |