C++里
extern __declspec(dllexport) int* GetPoint(char* path)C#里
[DllImport("aaa.dll", EntryPoint = "GetPoint")]
public static extern Array GetTextBlock(string path);提示找不到入口点,请问这样该怎样调用呢?
extern __declspec(dllexport) int* GetPoint(char* path)C#里
[DllImport("aaa.dll", EntryPoint = "GetPoint")]
public static extern Array GetTextBlock(string path);提示找不到入口点,请问这样该怎样调用呢?
然后用Marshal.Ptr,然或用循环用Marshal.ReadInt32获取每个数组值
但是你这是一个不好的方式,
第一 int* 返回值是在dll内部开的内存,谁来负责释放他,
第二,你没有返回具体的数组大小信息,c#很不好明白它具体的尺寸,
所以最好把数组作为参数从c#传入dll,再由dll填充他
通过
int[] array = new ....
Systsem.Intptr ptr = Marshal.UnsafeAddrOfPinnedArrayElement(array,0);
yourdllmethod(ptr,str);