PDA

View Full Version : BOOL data type acting funny when it is the return type for a DLL call



_redec_
02-09-2005, 04:41 PM
In my installation, I have 2 DLLs....in the first DLL functions with the return type BOOL work properly....in the second DLL for some reason they do not.

here are the prototypes: (I've tried stdcall and cdecl, both do the same thing)
bool __stdcall Test();
prototype STDCALL BOOL MyDLL.Test();

it appears to me that the installshield BOOL type is 4 bytes, while the C++ bool type is 1 byte, and they're not transferring properly...the lowest byte of of the returned value is always the proper value (0x00 or 0x01), but the upper 3 bytes are pretty much random (which of course makes the value true, even when returning false).
The thing that confuses me is how come my first DLL works....the difference between the 2 is that the one that works is written in managed c++ and the one that doesn't is in native c++....but the bool datatype is 1 byte in both instances, so I don't see why the one would work but the other wouldn't....can someone shed some light on this for me?