Hi,
Introduction
*****************
I am writing a mixed mode assembly, this assembly is used to expose
performance critical functionality implemented through an unmanaged .lib file
to the managed world.
The problem
*****************
when adding to one of the unmanaged classes __declspec(novtable) the managed
linker pours a collection of errors:
DBAccess error LNK2020: unresolved token (0A000019) exception.__ctor
DBAccess error LNK2020: unresolved token (0A000035) exception.__dtor
DBAccess error LNK2020: unresolved token (0A000037) memmove
DBAccess error LNK2020: unresolved token (0A000039) atexit
....
When removing the '__declspec(novtable)' the linking succeed.
My Assumption
*****************
The managed linker adds the unmanaged classes definition to the managed
meta-data section ( although it shouldn't ), as such, the added ( unmanaged )
classes should be compatible with the CLI, this require each of the classes
to have a virtual table ( so interop and so could be enabled ), adding
'__declspec(novtable)' prevents the VTable from being created and causes the
unmanaged class to be non CLI compliant.
The questions:
******************
A. Does my assumption is true?
B. is there any conventional way of preventing the unmanaged classes
metadata from being generated?
C. What else could I do to prevent this error from happening?
--
Nadav
http://www.ddevel.com