c# interop dll method seems to return wrong values

Joined
Oct 25, 2011
Messages
1
Reaction score
0
Hi

I am using vs2005.

I think my c++/mfc app was working fine with the c# dll up until I decided to change the c++/mfc app to be able to compile 64bit. It meant changing a lot of int and UINT to INT_PTR.

Anyway, now, when running the 32 bit edition of my program, I am finding for one of the methods in the DLL, that even though it returns "true" for the bool value, the value returned by the IDL interface method (as a VARIANT_BOOL parameter) is invalid.

eg:

Code:
VARIANT_BOOL bRes;
pInterface->SomeFunction(&bRes)
if(bRes == VARIANT_FALSE)
{
  AfxMessageBox("There was an error");
}
I tried to look at the value of bRes by formatting a string with %d and the value was not -1 or 0. It was some four figure negative value.

So even though the C# method was OK and returned a proper value the return value on many occasions is ending up as incorrect in C++/MFC calling code. So I get errors displayed.

Why might this be happening? I don't know enough about this.

Thank you.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top