I'm sure this has probably been asked before .... I have rewritten a COM DLL into C#, with a number of interface functions, and a number of events that can be fired back to the client(s). I can call it from a VB (6) client without problems. However, when I try to use a C++ client (still visual studio 6) that worked with the old DLL, any call to an interface function gets the error "The value of ESP was not properly saved across a function call."
A couple of example functions would be : (C#) int DialDigits([MarshalAs(UnmanagedType.BStr)]string bsUserId, [MarshalAs(UnmanagedType.BStr)]string szDigits); int QueryStatusString([MarshalAs(UnmanagedType.BStr)] ref string pbsStatus); (C++) m_pInterface->DialDigits(_bstr_t("1001").copy(), _bstr_t("01234567890").copy()); BSTR bsError; if ( m_pTapi->QueryStatusString( &bsError ) == S_OK ) .... Both of these function calls get the same error. The VB client doesn't seem to care whether the C# parameters are marshalled or not, they just works, but I added the marshalling as hinted by some other web site, but that didn't help in this C++ case. Is there anything wrong with either my C#' interface definition, or is something special required in order to call a .NET COM dll from unmanaged code ? I can post the full interface if necessary, but it is a big lengthy. I actually converted the IDL to C# by hand, but when it worked from VB, I assumed I'd got it all right, but now I'm not so sure. Can anyone help ? - Tim -- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to dotnetdevelopment@googlegroups.com To unsubscribe from this group, send email to dotnetdevelopment+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net