Re: Strane linker errors when exporting DLL that uses ADO
On Apr 24, 6:07 am, "Giovanni Dicanio" <giovanni.dica...@invalid.com>
wrote:
"Ulrich Eckhardt" <eckha...@satorlaser.com> ha scritto nel messaggionews:e=
2t5e5-lcp.ln1@satorlaser.homedns.org...
class __declspec(dllexport) A
{
//All kinds of stuff
virtual method( _RecordsetPtr rs );
};
Well, that will fail if you include above code there, because that code
would tell the compiler that you want to export both A and B from that
other DLL. You need to switch to __declspec(dllimport) for code that
actually should import stuff from a DLL.
I thought that the OP's code was just a sample code, not the real code.
In fact, he wrote:
<quote>
The weird thing is that if I change the method
to not be virtual, or if I change the parameter to not be a
RecordsetPtr, the code links successfully.
</quote>
so my understanding was that the OP had correctly implemented the
__declspec(dllexport/import) mechanism, e.g. using the classical
preprocessor conditional stuff:
// In MyDll.h
#ifndef MYDLL
#define MYDLL __declspec(dllimport)
#endif
class MYDLL A
{
...
};
and:
// In MyDll.cpp
#define MYDLL __declspec(dllexport)
#include "MyDll.h"
...
Giovanni
Yes, I used the correct export/import mechanism (the code I posted was
just an example).
Namespaces! Of course! I should have thought of that :( The same
name is used within and without a namespace. Using dumpbin (thanks
for the tip!) I saw that the namespace reference was what made the
difference. Now the question is can I fix taht without overhauling
the legacy code that this is in...but that is a technical thing.
Thanks guys!