olidev
olidev

Reputation: 20644

wrapper class for C++ in .net?

I am having a C++ project. i would like to port it to a C#.NET project. I have done some research and I think the most popular way is to use pinvoke.

I dont know whether there are also other methods existed?

Thanks in advance.

Upvotes: 1

Views: 754

Answers (4)

Krizz
Krizz

Reputation: 11542

You can:

1) Rewrite the entire project in C#

2) Reuse several components using either:

  • P/Invoke to reuse unmanaged compiled code

    or

  • C++/CLI to create wrapper classes

Upvotes: 6

konrad.kruczynski
konrad.kruczynski

Reputation: 47561

Well, plain P/Invoke is good to interface with C, but if you want to interop with some real C++ code, you would have to use something more sophisticated. With .NET, you can use C++/CLI. On Mono on and .NET you can use:

First option is less mature but seems to be more elegant.

Upvotes: 2

Matthias
Matthias

Reputation: 16209

You can also use SWIG.

Upvotes: 1

Yochai Timmer
Yochai Timmer

Reputation: 49251

You could use C++/CLI to create wrapper classes.

Upvotes: 1

Related Questions