【发布时间】:2014-02-28 10:15:23
【问题描述】:
我目前的解决方法是从 C# 获取向量的大小:
[DllImport("BridgeInterface.DLL", EntryPoint = "#46", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl]
private static extern int GetVectorSize();
BridgeInterface.dll 是我的 C++ 和 C# 代码之间的 C++ 桥接接口。然后我使用以下方法编组每个向量元素:
[DllImport("BridgeInterface.DLL", EntryPoint = "#47", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl]
private static extern double GetVectorElement(int index);
有没有办法使用对 C++ 的一次调用来编组整个向量?
【问题讨论】:
标签: c# c++ vector marshalling