Hi there,
we have this C++ DLL we wrote some time ago to do some Win32 native
stuff for us.
The function we're calling in the DLL returns a boolean value (type
bool) indicating success of the operation.
We declare the import in C# like follows:
DllImport("xyz.dll")]
private static extern bool DoSomething(...);
We call the function like this:
bool result = DoSomething(...);
Now: we're using this in Visual Studio 2008. When we set the target
framework version to 2.0 everything works fine - the function returns
false, the result-variable has the value false.
As soon as we switch the target framework version to 3.5 (no other
changes to the project), the C++ function still returns false, but the
result-variable is set to true!
How could that be?
As a workaround we've change the result type from bool to int, returning
defined values for success or failure, but this is not very satisfactory...
Any advice?
Thanks
Thorsten