473,395 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Where to specify the reference to DLL?

BG
Hi,
I have created a C++/CLI dll, say D, with VS 2005.
Now I want to use it in a project, say P, which is a console solution of
type managed C++.
They both compile with /clr .
D has a ref class which I want to use in P.

With header file of D included in P, P compiles fine, but then I get several
such link errors
TestDriver.obj : error LNK2020: unresolved token (06000018) MyClass::MyFunc
Attempted solutions:
1. _declspec(dllexport)
In D, if I change
ref class MyClass to
ref class __declspec(dllexport) MyClass, I get several such errors
__declspec(dllexport)/__declspec(dllimport) cannot be applied to a managed
type
during compile.

2. Tried to add D.dll as reference in P using Properties page. Didn't work.
Still got link time errors.
3. Tried to add D.dll as Project reference in P using Properties page. Still
got linking errors.

Questions:
1. In D, do I need to specify some functions for export? If so, how? All the
functions I want to use are in a ref class.
2. In P, where do I need to add a reference to D?
3. Any other link time attribute I need to add/modify?

Thanks for your help.
Feb 5 '06 #1
2 1287
BG wrote:
Questions:
1. In D, do I need to specify some functions for export? If so, how? All the
functions I want to use are in a ref class.
It's as simple as declaring it public:

public ref class MyClass [...]

Now MyClass is accessible to other managed modules.
2. In P, where do I need to add a reference to D?
#using <MyClass.dll>

or adding a reference to it in your project. What errors did you have?
Did you add the DLL's path to your #using path?
3. Any other link time attribute I need to add/modify?


The DLL must be on the path, so your application can find it.

Tom
Feb 8 '06 #2
BG
"Tamas Demjen" <td*****@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
BG wrote:
Questions:
1. In D, do I need to specify some functions for export? If so, how? All
the functions I want to use are in a ref class.


It's as simple as declaring it public:

public ref class MyClass [...]

Oops and Thanks.
That's exactly what I hadn't done.
Feb 11 '06 #3

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

Similar topics

3
by: Hal Vaughan | last post by:
My first Java project has gotten to the point where there are so many .java and .class files that I'd like to keep them separated so I can easily keep files straight. I have my /home/me directory...
17
by: Larry Woods | last post by:
I have a custom 404 error page. When I change my site properties in IIS (IIS 5.0, BTW) to point to a file, I still get the original 404 error page. But, then I copied my error page to my root,...
2
by: Matt | last post by:
I have a page1.asp that opens a window called page2.asp. I want page2.asp doesn't have title bar, tool bar, address bar. Is it possible to specify in javascript function window_onload() in...
0
by: Terence Tirella | last post by:
Is there a way to not specify a specific version of an assembly when you add a reference in Visual Studio? The problem I'm having is that when I add a reference to a GAC assembly (the Crystal...
46
by: clintonG | last post by:
Documentation tells me how but not when, why or where... <%= Clinton Gallagher http://msdn2.microsoft.com/en-us/library/saxz13w4(VS.80).aspx
3
by: brimp | last post by:
In c++, I need to have arrays of 256 nodes where the number of references in the nodes of an array is not determined until run time. The number of references is passed in to the constructor of a...
0
NeoPa
by: NeoPa | last post by:
Background Whenever code is used there must be a way to differentiate the actual code (which should be interpreted directly) with literal strings which should be interpreted as data. Numbers don't...
1
by: not_a_commie | last post by:
I was hoping for increased functionality with the where clause in C# 3.0. Using the new keyword 'var' would really allow us to take nice advantage of these. Specifically: 1. I want to limit it...
0
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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,...

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.