C# mashal const std::list<object> from c++ dll
c# mashal const std::list<object> from c++ dll
我必须在c#中使用c++ DLL并且我必须在我的c#程序中导入在c++ DLL中定义的这个函数:
void rtdGetSkillsetListResult(bool success, const std::list <skillset_info> skillsetList)
如何在c#中"翻译"
const std::list <skillset_info>
其中skillset_info在c++ DLL中定义了如下结构:
struct skillset_info
{
std::string code;
bool standby;
};
非常感谢!
托管c#代码不能使用像std::list
这样的非托管c++对象。因此,您不能直接从c#中使用非托管DLL。
最简单的解决方案是创建一个c++/CLI层,它可以从非托管到托管。
另一个选择是调整未管理的代码,使其可以用p/invoke调用,但我认为这将比c++/CLI需要更多的努力。
相关文章:
- 如何解决"invalid conversion from 'char' to 'const char*'"
- EASTL矢量<向量<int>>连续的
- std::async from std::async in windows xp
- std::is_reference from std::any
- std::time_point from and to std::string
- "No suitable conversion function from 'std::string' to 'const char *' exists"
- std::chrono::time_point from std::string
- Visual accept std::string from std::byte iterator
- C++中链表的错误"Abort signal from abort(3) (sigabrt) "
- dopen():不以 root 身份运行时"failed to map segment from shared object"
- C++ 中的"template <typename From, typename Tag> struct Alias;"是什么?
- from std::vector to adept::avector
- qt get child (Callout) from QChart
- Webassembly from Javascript
- Generate boost::uuids::uuid from boost::compute::detail::sha
- 什么是"Reading unbounded stream from standard input (Memory Management)"的例子
- Calling C++ dll from python
- 为什么我会收到"invalid conversion from 'Queue*/Stack*' to 'int'"错误消息?
- std::chrono 在从 main 或 from 类方法使用时给出不同的值
- Calling Python Script from Visual Studio C++ Solution