I have the following function in a C++ DLL
extern \"C\" __declspec(dllexport) bool Exist(const char* name)
{
//if (g_Queues.find(name) != g_Queues.end())
/
This is actually caused by EAX not being fully cleared out by typical C++ code that returns a bool
. It's typical for EAX to contain some bogus value when entering a function, and to return false
the compiler would typically emit xor al, al
. This clears out only the LSB of EAX, and causes C# code to interpret the resulting non-zero value as true
instead of false
.