最近需要在C#中调用Labview生成的dll,无非就是非托管dll的调用,难点在于类型的转换,Labview中的类型和C#中类型的转换。
函数原型:
void TestFun(char Path[],CharPro[])
调用方法:
[DllImport("TrustSystem.dll", EntryPoint = "TestFun", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
public static extern void TestFun([MarshalAs(UnmanagedType.LPStr)] string Path, [MarshalAs(UnmanagedType.LPStr)]string project);
直接调用TestFun即可。