Importing a VC++ class into a C# program

R

Rookie

Hi

I had a couple of questions:

1.)I am trying to invoke member functions of a class which is coded in
VC++ from a UI that is coded in C#. Firstly, if I am not mistaken I
think this can be done only if the exposed classes are managed. I am
totally new to this. So can someone give some pointers or maybe some
URLs to links on how this can be done - that is how to firstly be
able to export the classes and also how to make them managed/write
managed wrappers for the class.

2.)Once the VC++ coding is done, how do I invoke the member functions?
How do I instantiate an object of the VC++ classes in the C# code. It
would be great if someone could post some links to good articles that
deal with this.

Thank you.
 
W

Willy Denoyette [MVP]

1) You can't directly expose a native interface to managed code, your only
option is to use "Managed Extentions C++" or VS2005's C++/CLI to wrap a
managed reference class around your native class and populate it with stub
methods that invoke the associated native methods.
2) Invoking the methods is done by simply invoking the stubs.

Willy.
 

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