i need to use the native code(unmanaged code),and i have to use void*,so i use the "unsafe" symbol then i meet the trouble
c++code:
SC_InitAsk sca;
memset(&sca, 0, sizeof(sca));
sca.m_Head.m_nType = SC_INIT;
sca.m_dwSoftware = 0x12345678;
sca.m_hWnd = m_hWnd;
m_Dll.SCInit(&sca, sizeof(sca)
c# code:
unsafe
{
SC_InitAsk sca = new SC_InitAsk();
sca.m_Head.m_lIndex = PublicValue.SC_INIT;
sca.m_dwSoftware = 0x12345678;
sca.m_hWnd = this.Handle;
SCInit(&sca, sizeof(SC_InitAsk));
}
c++ interface:
BOOL WINAPI SCInit(void *pInit, int nSize);
c# reference definition:
public unsafe static extern bool SCInit(void* pInit, int nSize);
---------
my trouble:
when debug c#,i got dismatching error with the c++ interface,then i can't find out what's wrong,for the reason may be the struct definition or the "void *"
so how i can work it out ,or how i can debug this?
Anwar BuchooPosted Feb 22, 2006, 2:16 AM
Try to compile your code using the csc (C-Sharp Compiler) from the Visual Studio .NET Command Prompt and specify the switch /unsafe
Rgds.
rsm1235Posted Feb 10, 2006, 7:45 PM
sorry,dismatch mean mismatch