有一个vb的程序要转换成c#的,调用一个dll,原函数是:
Function abc lib "test.dll"(Byval a as long ,b as Any) as Long
其中实际调用时b为一个Type类型,内容为:
Type TYPEB
  b1 as long
  b2 as Integer
  b3 as Long
End Type
但翻译成c#时我不知道怎么写,
目前是写成
[DllImport("test.DLL",EntryPoint="abc",
                         CallingConvention=CallingConvention.StdCall)]
                public static extern long abc(long a,
[MarshalAs(UnmanagedType.Struct)] TYPEB b);//TYPEB是一个struct,与vb中的Type相对
应,结构为:
struct TYPEB
{
long b1;
int b2;
long b3;
}
调用时提示System.NullReferenceException: Object reference not set to an
instance of an object.
我试过好多办法,比如说用object、或者加ref,out都出现上面的错误,请问应该如何解决