i have c++ type definition like this
typedef void* ScreenNode;
and use it in my c++ code like this
ret = InitNode("factory", &g_screen_node, 128, 128, EN_C1Dev);
**EN_C1Dev is a ENUM
my typedef variable is a void pointer and InitNode return a value by changing pointer value "g_screen_node".
now i use this function in a dll inside a C# program with this definition
c++ code
extern "C" __declspec(dllexport) int CB_initNode(ScreenNode* p_g_screen_node,int width,int heigth,EN_DevType EN_C1Dev) { int ret = 0;
//InitNode ----------------------------------------------------------------
ret = InitNode("factory", p_g_screen_node, 128, 128, EN_C1Dev);
return ret;
}
dll definition class
[DllImport(dllName)]
public static extern
int CB_initNode(out IntPtr g_screen_node, int width, int heigth, EN_DevType EN_C1Dev);
and finally my main program
IntPtr g_screen_node = new IntPtr();
ret = BBIA.CB_initNode(out g_screen_node , 128, 128, EN_DevType.EN_C3Dev);
the CB_initNode function return error code and g_screen_node not return Expected value and stay on 0x00000000!
ref int g_screen_node
instead and passref ab
. This will not fix your error, but it's still something you should change.) – cdhowie