移植 C++ 的最佳方法是什么?库到 C#?
我有一个(仅标头)C++ 库,我希望将其移植到 C#。它是我出于某种目的而制作的 win api 的包装。我想将其移植到 C#,因为我想使用 C# 进一步开发它。最有效(也是最简单?)的移植方法是什么?请注意,我不想做一些忙碌的事情,因为我不想花更多的时间来移植库而不是首先创建该库。那么有办法吗?
I have a (header only) C++ library that I am looking to port to C#. It is a wrapper of the win api which I have made for a certain purpose. I want to port it to C# because I want to develop it further using C#. What is the most efficient (and easiest?) way to port it. Please note that I do not want something hectic because I don't want to spend more time porting the library than it took to make that library in the first place. So is there a way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这在很大程度上取决于您的库有多大、它的结构如何、您的内存分配方式、您使用了多少 C# 中不可用的库(例如 C++ 标准库)、您使用了多少 C++ 模板编程 不同的
策略可能是
“仅标头”似乎没有真正的区别。事实上,当每个类只有一个 C++ 文件要移植到一个 C# 类文件时,技术上事情可能会变得容易一些。
It depends very much on how big your lib is, how it is structured, how your memory allocation looks like, how much you made use of libs not available in C# (like the C++ std lib), how much C++ template programming you have used etc.
Different strategies may be
"Header only" does not seem to make a real difference. In fact, things may technically get a little bit easier when you have just one C++ file for each class to be ported to one C# class file.
我能想到的几种方法。
由于您已经拥有可以完全控制的 C++ 库,因此我会首先尝试使用#2。
A couple of ways I can think of.
Since you already have c++ library that you can fully control, I would try to go with #2 first.