P
philipqiu
hi
I want to call unmanaged functions that are implemented in a dll. The
problem is about the method return values. for example
#include "stdafx.h"
typedef struct toOut
{
int (WINAPI* ONE)(int x, int y);
char (WINAPI* TWO)(char a);
}myToOut;
myToOut x;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int WINAPI sum(int x, int y)
{
return x+y;
}
char WINAPI tochar(char a)
{
char x = a;
return x;
}
myToOut* WINAPI GetOut()
{
x.ONE = sum;
x.TWO = tochar;
MessageBox(NULL, "Ok", "", MB_OK);
return &x;
}
The preceding example return a struct,and the struct contains two point .the
question is how to set the marshaling of the GETOUT method value.
Thanks
philip
I want to call unmanaged functions that are implemented in a dll. The
problem is about the method return values. for example
#include "stdafx.h"
typedef struct toOut
{
int (WINAPI* ONE)(int x, int y);
char (WINAPI* TWO)(char a);
}myToOut;
myToOut x;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int WINAPI sum(int x, int y)
{
return x+y;
}
char WINAPI tochar(char a)
{
char x = a;
return x;
}
myToOut* WINAPI GetOut()
{
x.ONE = sum;
x.TWO = tochar;
MessageBox(NULL, "Ok", "", MB_OK);
return &x;
}
The preceding example return a struct,and the struct contains two point .the
question is how to set the marshaling of the GETOUT method value.
Thanks
philip