COM/VC++ .NET problem 
Author Message
 COM/VC++ .NET problem

Hey all,

I'm having problems calling a COM object in VC++ .NET (WIN32 target). I'm
using COM smart pointers with the "#import" directive.

I'm getting an error: "Run-Time Check Failure #0 - The value of ESP was not
properly saved across a function call. This is usally a result of calling a
function declared with one calling convention with a function pointer
declared with a different calling convention."

My code is something like --

#define _WIN32_DCOM
#include "stdafx.h"
#import "si_com.dll" /* creates namespace SI_COMLib */
#define SI_ProgID "Si_com.SIWrapper"
int _tmain(int argc, _TCHAR* argv[])
{
    CoInitialize(NULL);
    SI_COMLib::ISIWrapperPtr oSI;
    oSI.CreateInstance("SI_COM.SIWrapper");
    oSI->PutWorkingDirectory("c:\\Program Files\\Cardlink\\SISv2");
    int resp = oSI->SITest(); <<== this is the offending line of code
    CoUninitialize();
    return 0;

Quote:
}

The de{*filter*} stops in the _generated_ code --

inline int ISIWrapper::SITest ( ) {
int _result = 0;
HRESULT _hr = raw_SITest(&_result); <<== BREAKS HERE
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _result;

Quote:
}

Any ideas anyone, please? Is this my fault (I assume it is) ?

Thanks,

Alex.



Sun, 09 Oct 2005 02:40:03 GMT  
 COM/VC++ .NET problem
you might check if you are using the correct proxy-stub
dll file. Which should be generated during the server
build and should get correctly registered.

Quote:
>-----Original Message-----
>Hey all,

>I'm having problems calling a COM object in VC++ .NET
(WIN32 target). I'm
>using COM smart pointers with the "#import" directive.

>I'm getting an error: "Run-Time Check Failure #0 - The

value of ESP was not
Quote:
>properly saved across a function call. This is usally a
result of calling a
>function declared with one calling convention with a
function pointer
>declared with a different calling convention."

>My code is something like --

>#define _WIN32_DCOM
>#include "stdafx.h"
>#import "si_com.dll" /* creates namespace SI_COMLib */
>#define SI_ProgID "Si_com.SIWrapper"
>int _tmain(int argc, _TCHAR* argv[])
>{
>    CoInitialize(NULL);
>    SI_COMLib::ISIWrapperPtr oSI;
>    oSI.CreateInstance("SI_COM.SIWrapper");
>    oSI->PutWorkingDirectory("c:\\Program

Files\\Cardlink\\SISv2");

- Show quoted text -

Quote:
>    int resp = oSI->SITest(); <<== this is the offending
line of code
>    CoUninitialize();
>    return 0;
>}

>The de{*filter*} stops in the _generated_ code --

>inline int ISIWrapper::SITest ( ) {
>int _result = 0;
>HRESULT _hr = raw_SITest(&_result); <<== BREAKS HERE
>if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof
(this));
>return _result;
>}

>Any ideas anyone, please? Is this my fault (I assume it
is) ?

>Thanks,

>Alex.

>.



Sun, 09 Oct 2005 04:34:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with .NET COM object import to VC++ 6

2. migrating com object from vc 6 to vc .NET

3. Problem calling VB COM dll from VC++ multithreaded COM EXE client

4. Problem with scripting context when using VB com object inside VC com object

5. problems passing ADO Recordset from VB-COM client to VC-COM-Server dll

6. Problem converting VC++ 6.0 project to VC++.net

7. Problem porting ATL project from VC++ 6.0 to VC++.NET 2003

8. Problem with ATLCONV.H when porting from VC++6.0 to VC++.NET

9. problem porting an application from VC++ 6 to VC++ .NET

10. VC 6 -> VC.NET Problem

11. problem porting an application from VC++ 6 to VC++ .NET

12. Build COM servers with vc++.net for WinCE?

 

 
Powered by phpBB® Forum Software