473,471 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

Hi,
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:
'http://msdn2.microsoft.com/library/c3d162w5.aspx'
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
Stefan
Nov 17 '05 #1
0 1097

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mccoyn | last post by:
I'm porting an old project to use .NET. When I try to link in a static library (.lib) that has a single managed class in it. I get the following errors: LINK : error LNK2020: unresolved token...
2
by: Jacob Cohen | last post by:
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...
5
by: Adam McKee | last post by:
We are using Visual Studio.NET 2003 in our project with .NET framework 1.1. One of our libraries is a mixed-mode dll assembly consisting of one managed C++ library, and several unmanaged C++...
3
by: Simon Jefferies | last post by:
Hello, I am trying to use a Managed C++ .NET (DLL) Class library within my Managed C++ .NET forms application. I have both projects in the same solution and have the class library under my...
10
by: Gustavo L. Fabro | last post by:
Greetings! I've been porting an application for Builder to VS .NET 2003 and searching for possible bottlenecks (the application is currently running slow). I found out one scenario that takes a...
0
by: Gustavo L. Fabro | last post by:
Greetings! I found myself with a LNK2020 linking problem using VS.NET 2003 under a situation that I was able to replicate in a small project. I found one workaround for the problem too, but...
0
by: crafuse | last post by:
Hello all, I'm trying to create a mixed DLL using VC++ .NET 2003. Specifically, I have some TAO CORBA .cpp files that I wish to include as native object code in the DLL and some managed classes...
0
by: Roland | last post by:
Hi, ultimately I want to call some unmanaged C++ class that contains some DirectShow code of mine from my C# classes, but for the time being I'd be happy if I could get this to build! I have...
0
by: rob | last post by:
I did create a dll A using managed c++. I have no problem using this dll in a .NET application using c#. I now have another dll B that uses functionality from the first dll A. When building dll B I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.