Calling C++ DLL from C#

K

kelvin.koogan

Using VS 2005.
I want to write a DLL in C++.NET that will then be used in a Windows
Forms application written in C#.
How do I write the C++ DLL such that C# will be able to use it?
How do I then use the DLL in C#?

TIA,
KK
 
D

David Lowndes

Using VS 2005.
I want to write a DLL in C++.NET that will then be used in a Windows
Forms application written in C#.
How do I write the C++ DLL such that C# will be able to use it?
How do I then use the DLL in C#?

If you write it in C++/CLI you can create a seamless interface to your
C#. I'd define an idealised C# interface and then convert that to
C++/CLI syntax.

In your C++/CLI you can interface to native code effortlessly (or as
effortless as it can be) :)

Using the C++/CLI DLL is as easy as it is if it were C# or VB.Net -
just add a reference to it and you can then access its public classes
and methods.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top