hi all,
I have to return an integer value from vc++ to c# wcf .in vc++ the function works fine but in c# the function returns wrong integer value.
in vc++
typedef struct
{
BOOL bALerm1;
BOOL bALerm2;
BYTE bLevel;
}myStruct,
__declspec(dllexport) static int getStatus();//declaration
ClassA theApp;//object creation
int ClassA::getStatus()
{
myStruct tmpASS;
int status=-1;
tmpASS=myObj->GetZoneStatus(); //assgn value
if (tmpASS.bALerm1==TRUE)
{
status=1;
}
else
{
status=0;
}
}
return status;
}
extern "C" __declspec(dllexport) int getStatus()
{
return theApp.getStatus();
}
in c# side
[DllImport("myDll.dll", SetLastError = true,
CallingConvention = CallingConvention.Cdecl)]
public static extern int getStatus();
int status=getStatus();
always returns 0,can any one help plz!thanks