473,395 Members | 1,386 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.

Export / Import C++ Managed Classes

Hello,

I am writing some C++ classes and want to export them as .dll files so
other users can import them and use the methods I have provided in
those classes. I have two types of classes : unmanaged (or regular
classes) and managed (__gc classes). I already know how to use
"__declspec(dllexport)" to export and "__declspec(dllimport)" to import
"unmanaged" classes. However I dont know how to export "managed"
classes since this method doesnt work for them.

Can anyone help me with this ?

Regards,
Amir

May 26 '06 #1
3 6126
Hi amirbehzadan!
I am writing some C++ classes and want to export them as .dll files so
other users can import them and use the methods I have provided in
those classes. I have two types of classes : unmanaged (or regular
classes) and managed (__gc classes). I already know how to use
"__declspec(dllexport)" to export and "__declspec(dllimport)" to import
"unmanaged" classes. However I dont know how to export "managed"
classes since this method doesnt work for them.


Just declare it as "public" and put it into a namespace. That´s it.

Any other managed programming language can simply reference the DLL and
use your class.

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
May 26 '06 #2
Hi Jochen,

Thanks a lot. That solved the problem of creating the DLL file. Now
when I am using the corresponding header and library file in a test
application to use that DLL file, I get a number of "unresolved tokens"
that most of them point to the functions inside the imported managed
class. Examples are :

Test error LNK2020: unresolved token (0600000B) TCM::.ctor
Test error LNK2020: unresolved token (0600000C) TCM::Finalize
Test error LNK2020: unresolved token (0600000E) TCM::Start
Test error LNK2020: unresolved token (0600000F) TCM::Stop
Test error LNK2020: unresolved token (06000010) TCM::BytesInRQ
Test error LNK2020: unresolved token (06000011) TCM::stdString
Test fatal error LNK1120: 6 unresolved externals

the last four functions are functions inside the imported managed class
TCM.

Thanks,
Amir

May 26 '06 #3
Hi amirbehzadan!
Thanks a lot. That solved the problem of creating the DLL file. Now
when I am using the corresponding header and library file in a test
application to use that DLL file, I get a number of "unresolved tokens"


You *must not* use header and lib-files!!!

Just add (VC2003):
#using <MyManagedDll.dll>
Or in VS2005, add the reference to your project properties
(Common|References).
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
May 27 '06 #4

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

Similar topics

0
by: Dave Irick | last post by:
We are looking for assistance in setting up export/import jobs that will use DLT tapes managed by Netbackup. The issue seems to be how to specify the "file" parameter of export/import so that it is...
8
by: An Ony | last post by:
Hello, I'm trying to write a program (dll) to use with mIRC. mIRC wants me to use these kind of functions: int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show,...
0
by: Rob Burke | last post by:
I'm trying to create a hybrid Managed/unmanaged C++ DLL that uses ATL and wraps some of DirectShow. When I add a reference to that Managed C++ DLL in another managed project, I end up...
2
by: Siu | last post by:
Hi, I use the following code to export and import a file Excel from resp. into a Web page with the following code: //EXPORT Response.Clear(); Response.Buffer = true; Response.ContentType =...
3
by: Iavor Raytchev | last post by:
Hello, We a situation with a central database that contains the data that needs to be presented at N off-line terminals (N can be 5 000 can be 15 000). Each terminal presents unique data. The...
2
by: amirbehzadan | last post by:
Hello, I am writing some C++ classes and want to export them as .dll files so other users can import them and use the methods I have provided in those classes. I have two types of classes :...
17
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
2
by: mike_dba | last post by:
I am attempting to move data between 2 DB2 Linux databases using a pipe. I can't seem to get it working. Any assistance is appreciated. I first issue: mkfifo -m777 mypipe db2 "connect to...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.