473,394 Members | 1,717 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,394 software developers and data experts.

Importing a DLL class (class exported from a VC++ DLL)

Hi,

I have a DLL written in VC++ which exports a class. I want to import this
class into a C# application and be able to instantiate it in the C# code. Is
it possible to do this?

If yes, is it using StructLayout? If yes, even after defining the class in
my C# app. using StructLayout how do I actually link my code to the DLL? Are
there any other settings to be changed?

I hope to hear from someone out there ASAP. Code samples, links to
tutorials/articles et al. would be most helpful. Thanks a lot.
Nov 16 '05 #1
2 4180
Rookie,

If the class is exposed through COM, then you can access it through .NET
(through the COM interop layer). However, if thi is just a regular C++
class, then you won't be able to do this. You will have to expose your
class through COM, or create a managed wrapper using Managed Extensions for
C++.

Hope this helps.
"Rookie" <do***********@rediffmail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
Hi,

I have a DLL written in VC++ which exports a class. I want to import this
class into a C# application and be able to instantiate it in the C# code. Is it possible to do this?

If yes, is it using StructLayout? If yes, even after defining the class in
my C# app. using StructLayout how do I actually link my code to the DLL? Are there any other settings to be changed?

I hope to hear from someone out there ASAP. Code samples, links to
tutorials/articles et al. would be most helpful. Thanks a lot.

Nov 16 '05 #2
Can remoting be used to create instances of a class exported from a VC++
DLL??

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uO**************@TK2MSFTNGP10.phx.gbl...
Rookie,

If the class is exposed through COM, then you can access it through ..NET (through the COM interop layer). However, if thi is just a regular C++
class, then you won't be able to do this. You will have to expose your
class through COM, or create a managed wrapper using Managed Extensions for C++.

Hope this helps.
"Rookie" <do***********@rediffmail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
Hi,

I have a DLL written in VC++ which exports a class. I want to import this class into a C# application and be able to instantiate it in the C# code.
Is
it possible to do this?

If yes, is it using StructLayout? If yes, even after defining the class

in my C# app. using StructLayout how do I actually link my code to the DLL?

Are
there any other settings to be changed?

I hope to hear from someone out there ASAP. Code samples, links to
tutorials/articles et al. would be most helpful. Thanks a lot.


Nov 16 '05 #3

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

Similar topics

1
by: Geoff Turner | last post by:
Hi all, OK, I have a DLL program that contains a couple of classes. There are two things I would like to know: 1: How do I export a class from a DLL 2: How do I import the class into VB6? ...
1
by: XBSANTOS | last post by:
Functions exported in C++ and global variables; Hello, I'm working with a DLL project in VISUAL C++ that exports one function with the sentence __declspec(dllexport). The problem is that this...
3
by: Halvdan Friis | last post by:
Hi, I've run into a problem with exporting and importing a function from a DLL. Hopefully somebody here can tell me how this should be done properly. My DLL function is as follows: void...
0
by: Rookie | last post by:
Hi, I have a DLL written in VC++ which exports a class. I want to import this class into a C# application and be able to instantiate it in the C# code. Is it possible to do this? If yes, is...
0
by: Ivan Lam | last post by:
Hi All, Thanks for reading my question. I am a newbie of VC .Net, and I am facing a problem about importing DLL. I have searched from the web and I download a simple sample. And the code...
5
by: Felix I. Wyss | last post by:
Good Afternoon, I recently noticed that some very simple methods of a template declared and used in a DLL library get inlined when used by the DLL itself, but not by other DLLs and EXEs. After...
4
by: Bernd Muent | last post by:
Hi together, I made a DLL in the following way (simplified example just to explain what is the problem) using devcpp and gcc compiler on Windows XP: dll.h: #ifndef _DLL_H_ #define _DLL_H_ #if...
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...
4
by: kurt.kurtsmith | last post by:
I am trying to import a tlb from a COM server(exe) I wrote with the following statement: #import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax.tlb" no_namespace auto_search the tlh and...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.