各位朋友,我的DCOM程序(在两台不同的机器上实现调用)已经成功,
不过这只是在被调用的接口函数没有任何输入/出参数的情况下成功的,
现在加上参数就出错了,程序提示为:
The value of ESP was not properly saved across a function call.
This usually a result of calling a function declared with one 
calling convention with a function pointer with a different call
convention.
我的接口函数是这样的:
HRESULT GetBestServer([out,string] wchar_t** str );
希望有专家给能在参数传递的的方式及数据类型上给予讲解,VC的类型
弄人啊^0^

解决方案 »

  1.   

    调用规则问题
    选 __cdecl?
      

  2.   

    可能的原因是客户端和服务器端的接口不一致。另外字符串定义成BSTR比较好,否则可能在marshling过程中出现问题。
      

  3.   

    谢谢大家帮助UP,问题我自己已经解决了。
    主要是原因在于我的服务程序中的代码。
    错误代码如下:
    GetBestServer(wchar_t** str)
    {
       *wchar_t=L"Hello";
       return S_OK;
    }
    正确代码如下:
    GetBestServer(wchar_t** str)
    {
       wchar_t sz[]=L"Hello";
       *str=sz;
       return S_OK;
    }
    两位朋友说得都很好,
    散分表示答谢UP!