How to import void * C API into C#?

后端 未结 3 1041
孤独总比滥情好
孤独总比滥情好 2021-02-20 10:17

Given this C API declaration how would it be imported to C#?

int _stdcall z4ctyget(CITY_REC *, void *);

I\'ve been able to get this far:

<
3条回答
  •  梦谈多话
    2021-02-20 11:00

    For the void* parameter you can just use an IntPtr

      [DllImport(@"zip4_w32.dll",
            CallingConvention = CallingConvention.StdCall,
            EntryPoint = "z4ctygetSTD",
            ExactSpelling = false)]
        private extern static int z4ctygetSTD(ref CITY_REC args, IntPtr ptr);
    

提交回复
热议问题