J
Jacob Cohen
Under VC7.1, I am trying to wrap a native-C++ DLL that contains C++
objects in a Managed-C++ class library for use in a C# project.
I created and compiled the native DLL under VC7.1 as a Win32 DLL C++
(unmanaged) project. I found the decorated names of the symbols I
wanted to export and created a .def file, so that it generated an
import library.
I took this import library and had my Managed-C++ class library link
against it. The managed code does the style of wrapping of classes
found in the MSDN section on migrating to managed C++. That is, each
class replicates the interface of the wrapped class and forwards the
calls through to the native-class pointer. This is where I do all my
marshaling and converting of types from their .NET representations to
the native representations.
The code all compiles fine, but when I go to link, I get a series of
LNK2020 errors, which are unresolved tokens in the metadata. I am not
sure how this differs from the usual LNK2001 unresolved external
symbol, but when I remove the DLL import library from the managed-c++
project, I then get LNK2001 errors instead. It seems like it is
linking against the native-C++ DLL's import library, but not finding
everything it needs.
What else do I need to provide to my Managed-C++ library to satisfy
these unresolved tokens in the metadata? The native-C++ DLL does not
have any assembly information or metadata, and I am not really sure
what exactly it is looking for. The errors are things like:
LINK : error LNK2020: unresolved token (0A0000AA)
CTS.MIBEventTable.bind
LINK : error LNK2020: unresolved token (0A0000AB)
CTS.MIBEventTable.__ctor
These methods are defined in the DLL (and exported in the .def). When
I remove the import library, these errors convert to being LNK2001.
Anyone have any ideas what I might be missing?
Thanks in advance.
Regards,
Jake.
objects in a Managed-C++ class library for use in a C# project.
I created and compiled the native DLL under VC7.1 as a Win32 DLL C++
(unmanaged) project. I found the decorated names of the symbols I
wanted to export and created a .def file, so that it generated an
import library.
I took this import library and had my Managed-C++ class library link
against it. The managed code does the style of wrapping of classes
found in the MSDN section on migrating to managed C++. That is, each
class replicates the interface of the wrapped class and forwards the
calls through to the native-class pointer. This is where I do all my
marshaling and converting of types from their .NET representations to
the native representations.
The code all compiles fine, but when I go to link, I get a series of
LNK2020 errors, which are unresolved tokens in the metadata. I am not
sure how this differs from the usual LNK2001 unresolved external
symbol, but when I remove the DLL import library from the managed-c++
project, I then get LNK2001 errors instead. It seems like it is
linking against the native-C++ DLL's import library, but not finding
everything it needs.
What else do I need to provide to my Managed-C++ library to satisfy
these unresolved tokens in the metadata? The native-C++ DLL does not
have any assembly information or metadata, and I am not really sure
what exactly it is looking for. The errors are things like:
LINK : error LNK2020: unresolved token (0A0000AA)
CTS.MIBEventTable.bind
LINK : error LNK2020: unresolved token (0A0000AB)
CTS.MIBEventTable.__ctor
These methods are defined in the DLL (and exported in the .def). When
I remove the import library, these errors convert to being LNK2001.
Anyone have any ideas what I might be missing?
Thanks in advance.
Regards,
Jake.