"Urs Vogel" <uv****@msn.com> wrote
I have a C++ interop project, which links fine with VS2003, but after
converting it to VS2005, it compiles everything withour errors/warnugs,
but I get the following linker message.
DBRDMUM.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
That's the module initializer. (In fact, it's the mangled name for
void __clrcall __identifier(".cctor")(); )
It is like static constructor but not associated with a particular
class. The module initializer is executed, once the assembly is
loaded (It's similar to DllMain)
VC uses it for dynamic initialization. E.g.:
// global scope
int foo();
int i = foo();
i is initialized at load time. The compiler creates a special
function (the dynamic initializer for i). Additionally it will
emit a "/include" linker directive for the module
initializer in the object file and the /DEFAULTLIB for the
managed CRT.
When the linker sees the directive, it includes the module
initializer even if it is not otherwise referenced. It is
defined in the managed CRT.
So what you need is the correct libraries. In VC 8 it is
no longer necessary to use /NOENTRY, /NODEFAULTLIB
(linker) or /Zl (compiler) etc. Just let the tool chain figure it out.
Dumpbin /DIRECTIVES should reveal the implied
linker switches for a given object file.
If that doesn't help can you post linker warnings and
the result of dumpbin /DIRECTIVES along with
the command line switches for the linker and compiler?
-hg