Wednesday, June 20, 2007

Marshalling Problem :(funny )

Marshalling Problem :

if we are accessing the fn in a VC++ DLL from C# application :

Note the following thing :

1.Within the VC++ DLL fn always make the return type as BOOL instead of bool keyword.

Note :
Try the problem with a simple VC++ DLL contains BOOL as a return type and another fn returns bool data type.

Call it from C# application.


Problems I faced :

bool DLLDIR GetStatus()
{
return false;
}

if I accessed this fn from C# application I got the return value as true.

So try it ...

if it gives the true value then add the OutputDebugString() fn to the GetStatus() fn...
and see what will happen ...( Result : it returns false...)

It is the proposed standard to use BOOL instead of bool , if we access it using interoperability mechanism.

No comments: