Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

bool bug: unmanaged to managed improper mashalling

Hi,
    This is quite a old bug and it happens when you make a function call which returns bool in unmanaged code from managed code.
    It always returns true inside managed code. I am trying to find a fix for this error. Does anyone know how to get rid of this bug. Any help appreciated. I cannot change my unmanaged code library written in C++.
   
Thanks,

Sarfaraz K

Sarfaraz Killedar
Monday, November 08, 2004

Try changing the prototype of the unmanaged function to return Int32 or UInt32, AND (&) the return value with 15 and test against 0 instead of false.  I don't know the size of a .net Boolean but I suspect it's not the same as your (C++?) unmanaged code's bool.

crm
Monday, November 22, 2004

I meant 255 not 15 above.  Anyway just test the lowest byte of the return value against 0.

crm
Monday, November 22, 2004

*  Recent Topics

*  Fog Creek Home