469,623 Members | 1,036 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

Gets LNK2020 error when trying to use native type between managed c++ dlls (whidbey)

Could anyone share some light on this and how I can work around it.

If I have 2 managed c++ dlls (A and B) and B tries to use a native
class in A this fails to link.
It is easily reproducable by taking the example from:
And then move the definition(?) of N::N to the cpp file. It will then
look like this:
// mcppv2_ref_class3.cpp
// compile with: /clr /LD
#include "mcppv2_ref_class3.h"
N::N() // moved here where it should be
// public managed type
public ref struct R
// public function that takes a native type
void f(N nn) {}

When compiling/linking mcppv2_ref_class4.cpp I get LNK2020 and LNK2001
mcppv2_ref_class4.obj : error LNK2020: unresolved token (0A00000B)
"public: __thiscall N::N(void)" (??0N@@$$FQAE@XZ)
mcppv2_ref_class4.obj : error LNK2001: unresolved external symbol
"public: __thiscall N::N(void)" (??0N@@$$FQAE@XZ)
mcppv2_ref_class4.exe : fatal error LNK1120: 2 unresolved externals

In my real world there are a number of native C++ classes in one of
the dll that I need to use from the other one. I'm not going to mess
up my code by moving all of it to the header files.

Regards & TIA
Nov 17 '05 #1
0 952

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Simon Jefferies | last post: by
reply views Thread by rob | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.