Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Feb 2007
Offline Last Active Apr 16 2012 01:30 PM

#4776269 C++ C# interop

Posted by on 19 February 2011 - 04:09 AM


Is there any SIMPLE way to use my c++ engine in c# (winforms)?
I don't wanna rewrite my engine. Instead of lots of c++ work, i rewrite it in c#... So I'm looking for the simplest solution. Now, i use lib, but if it is necessery, i can use dll, like this:

class __declspec(dllexport) Sprite : public GameComponent


No, there isn't a simple way to do it.

If you're working with windows alone, c++/clr is probably the easiest way to go.

If you're working with linux, you need to wrap it in a c glue library and create bindings to it in c#.

Both of these are time consuming, but that's the price you pay when trying to interop radically different languages.

There are utilities to create a glue library, though I'm a bit behind the times and couldn't recommend a current one (I haven't used anything but c# in a looooong time). Last time I did this. SWIG was the way to go, but it was still tedious and error prone.