views:

76

answers:

3

I have a renderer written in C++ and directX. I now want to write a (level / scene / UI) editor and if possible / realistic I would prefer to write the interface to my editor in C#/.net

Is this at all feasible, without going down a route of managed c++? Can I expose the necessary interface from my renderer to a C# app, without managed c++?

A: 

Well it depends on how you wrote it ... If you wrote the renderer as a COM object then you should have no troubles. As a DLL using C calls I believe is still relatively easy as well. Classes are more complex. AFAIK there is no way of doing it with out writing a managed C++ wrapper.

In fact this link: http://www.codeguru.com/cpp/cpp/cpp_managed/interop/article.php/c6867/ seems to agree with me :)

Goz
I've used the technique linked to by @Goz for a couple of years now and it works well. There is a fair bit of time involved in building the wrapper, but a plus is you can turn your C++ code into components and use them in the UI designer with Drag-Drop form building.
mcdave
A: 

Writing a wrapper in C++/CLI would be easier to accomplish (IMO) than using Managed C++. I've found it quite easy to understand and started with only a cursory understanding of good ol' C++.

Also, the C++/CLI syntax is nicer than the Managed C++ syntax.

I would recommend this book if you go down that road.

cmw
A: 

C++/CLI is the replacement for Managed C++, and is basically the same thing only better, so I assume your question applies to avoiding C++/CLI also. I think the answer is really no - you have to wrapper it in some kind of managed language for C# to access the classes, excepting the COM route.

Roderick