日期:2014-05-17 浏览次数:21313 次
//这是在.h头文件中定义的
struct _TestStruct;
typedef struct _TestStruct TestStruct;
//这是在.cpp文件中定义的
typedef struct _TestStruct
{
TestStruct1 struct1;
TestStruct2 struct2;
}TestStruct;
__declspec(dllexport) TestStruct* __stdcall Init()
{
return init();
}
__declspec(dllexport) BOOL __stdcall Update_Info(intptr_t* struct, char* key, char* value)
{
return update_info((TestStruct*)struct, key, value);
}
//释放
__declspec(dllexport) void __stdcall Free_Struct(intptr_t struct)
{
return free_struct((TestStruct*)struct);
}
[DllImport("Test.dll")]
public static extern IntPtr Init();
[DllImport("Test.dll")]
public static extern bool Update_Info(IntPtr struct, String key, String value);
[DllImport("Test.dll")]
public static extern void Free_Struct(IntPtr struct);