C# plugins using c++ code

I am working on c++ project where you can, like in vvvv, establish a data flow network and distribute data between the blocks. Now I just finished reading the dynamic plugin tutorial and I had an idea of using vvvv as rapid prototyping tool for my project.

Have you any experiece with wrapping c++ code for vvvv? I thought it might be possible to write c# wrapper classes for my c++ classes and then connect them via vvvv.

There’s 3 ways to bridge c++ code to vvvv plugins:

  • Create a standard c++ dll and use platform invoke in c# (not ideal if you have lots of classes/data structures, but for simple functions it’s fine)

  • Create a c++ mixed mode assembly, then use as a reference in a c# plugin (a bit like option above but quite more flexible). Bullet is kinda done like this, since bulletsharp is a mixed mode .NET wrapper.

  • Create a plugin in mixed mode c++ directly (that’s the way box2d/structure synth are built for example).

If got more questions feel free to ask.

If possible I’d like to use the third option. Is it also possible to use c++ data types directly without wrapping them?

Do you know where I can find a simple sample project for this approach?

If you check in svn there should be the box2d/structure synth code, which should give you a good idea to get started.

technically it should also be possible to write a plugin in c++ only, by using COM directly. there was an example once, but we’d need to review it. the plugin loading mechanism as it is build yet wouldn’t pick it up i think.

yay - a c++ plugin example would be very welcome.

thanks m9d