469,602 Members | 1,747 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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 4111
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Geoff Turner | last post: by
1 post views Thread by XBSANTOS | last post: by
3 posts views Thread by Halvdan Friis | last post: by
reply views Thread by Ivan Lam | last post: by
4 posts views Thread by Bernd Muent | last post: by
4 posts views Thread by kurt.kurtsmith | last post: by
reply views Thread by guiromero | 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.