可以嵌入 C++ C# 应用程序中的 dx 渲染器不使用托管 c++?
我有一个用 C++ 和 directX 编写的渲染器。我现在想编写一个(关卡/场景/UI)编辑器,如果可能/现实的话,我更愿意在 C#/.net 中编写编辑器的界面,
这是否可行,而不需要走托管 c++ 的路线?我可以在没有托管 C++ 的情况下将渲染器中必要的接口公开给 C# 应用程序吗?
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++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在C++/CLI中编写包装器比使用托管C++更容易完成(IMO)。我发现它很容易理解,并且一开始只是对优秀的 C++ 进行了粗略的了解。
此外,C++/CLI 语法比托管 C++ 语法更好。
如果您走这条路,我会推荐这本书书。
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 是托管 C++ 的替代品,基本上是相同的东西,只是更好,所以我认为您的问题也适用于避免使用 C++/CLI。我认为答案是否定的 - 您必须将其包装在某种托管语言中,以便 C# 访问类(COM 路由除外)。
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.
好吧,这取决于你如何编写它......如果你将渲染器编写为 COM 对象,那么你应该没有问题。作为使用C调用的DLL我相信还是比较容易的。类更加复杂。 AFAIK 如果不编写托管 C++ 包装器就没有办法做到这一点。
事实上这个链接:http://www.codeguru。 com/cpp/cpp/cpp_management/interop/article.php/c6867/ 似乎同意我的观点:)
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 :)