开发者

Possible to embed a C++ dx renderer in a C# app without using managed c++?

开发者 https://www.devze.com 2022-12-17 11:18 出处:网络
I have a renderer written in C++ and directX.I now want to write a (level / scene开发者_如何学Go / UI) editor and if possible / realistic I would prefer to write the interface to my editor in C#/.net

I have a renderer written in C++ and directX. I now want to write a (level / scene开发者_如何学Go / 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++?


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 :)


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消