extern "C" BOOL Func()
函数在VB.NET代码中声明如下:
<DllImport("mylib.dll", CallingConvention:=CallingConvention.Cdecl)>
Private Shared Function Func() As Boolean
End Function
既然如此 BOOL int 在这个C代码中,声明是否应该不同?如果是的话,我该怎么声明呢?作为 Short Int32 ? 我需要封送返回值吗?
BOOL
int
Short
Int32
C函数不返回真正的布尔值,而是返回一个整数。你可能需要 marshall it propery
编辑:同样,你应该让你的函数是静态的。