//Structure:
struct MYDATA{
char calls[4069];
char Desc[4096];
char error[1024];
} ;
//Test function
char *Argv[] = { "ToolName", "USername", "192.168.2", "3", "400"};
typedef void* ( *__stdcall pCstartSIPSessionint)(char **argv );
typedef struct MYDATA*(*__cdecl pgetStat) ();
pCstartSIPSessionint startSessionint = (pCstartSIPSessionint )GetProcAddress(HMODULE (hGetProcIDDLL),"startSessionint");
//Dll Import
HINSTANCE hGetProcIDDLL = LoadLibrary(TEXT("E:\\MyDll.dll"));
pgetStat getStat ;
getStat = (pgetStat ) startSessionint(Argv);
MYDATA *mydata;
if(getStat != NULL)
mydata= getStat();
printf("\n mydata\n %s ", mydata->call);
printf("\n mydata\n %s ", mydata->summary);
printf("\n mydata\n %s ", mydata->error);
How to Convert the code in C#? And i have confused to pass address of stucture to Void* in C# I can able to pass only values, how can pass Address to the structure.
Thanks in advance...!
The struct should be:
I assume the 4069 value in the question is a typo.
The first function is:
Then convert the function pointer to a delegate:
Now you can call the function:
And then marshal to the struct: