0

My question is more on the concept and less on the actual code.

I have an app in vb.net. I want to port a few classes to native c++ code (not cli) for various reasons. What I want to do is to be able to instantiate and use these classes, like i do in the fully managed app.

I understand that I can call static functions from a native dll, but this is not the case here. I need to instantiate classes and use them through the lifetime of the app.

So the question is, is this possible? And if so, could you point me to the right direction to start?

ildjarn
  • 62,044
  • 9
  • 127
  • 211
johnjohn
  • 4,221
  • 7
  • 36
  • 46
  • [C++/CLI](http://en.wikipedia.org/wiki/C%2B%2B/CLI) is where you start. – ildjarn Jul 06 '12 at 22:05
  • @ildjarn: But as far as I understand C++/CLI is managed. I want to have the classes in a native dll. – johnjohn Jul 06 '12 at 22:08
  • 1
    Yes, but C++/CLI is the only practical way to access a _C++ class_ from managed code (write a very thin wrapper around your native types). – ildjarn Jul 06 '12 at 22:09

1 Answers1

1

maybe you can take a look here
Instantiating a C++ class in C# using P/Invoke via a pointer
and here
http://www.codeproject.com/Articles/18032/How-to-Marshal-a-C-Class

Community
  • 1
  • 1
Max
  • 7,408
  • 2
  • 26
  • 32