Board index » cppbuilder » problem while using smart pointer for Com+ client in C++Builder

problem while using smart pointer for Com+ client in C++Builder

Hello,

I am studying program on Com+ services.

I met a problem while using smart pointer for Com+ client in C++Builder.
When I compiled a Com+ client example file in VC++, it worked OK.
But when I compiled it in C++Builder, the following Link error occurred:

[Linker Error] Unresolved external '__stdcall _com_issue_error(long)'
referenced from F:\MYAPP\CBUILDER5\IUNKNOWN INTERFACE\EASYCLIENT\MAIN.OBJ

The example main codes :

#define _WIN32_DCOM
#include <iostream.h>
#include <comdef.h>

#include "..\component with registration\component.h" // Generated by MIDL

// {10000002-0000-0000-0000-000000000001}
const CLSID CLSID_InsideCOM = {0x10000002,0x0000,0x0000,
    {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}};
//--------------------------------------------------------------------------
-

#pragma hdrstop

//--------------------------------------------------------------------------
-

#pragma argsused
int main(int argc, char* argv[])
{
        HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
        if(FAILED(hr))
                cout << "CoInitializeEx failed. " << endl;
#undef __BORLANDC__
        _COM_SMARTPTR_TYPEDEF( ISum , __uuidof(ISum) );

 ISumPtr myRef(CLSID_InsideCOM);

 int result;

        hr = myRef->Sum(5, 13 , &result);
 if(SUCCEEDED(hr))
                cout << "5 + 13 = " << result << endl;
 myRef = NULL;
 CoUninitialize();
        return 0;

Quote
}

//--------------------------------------------------------------------------
-

This client program use smart pointer to get COM interface, and implement
it's method.
whether I define or undefine "__BORLANDC__ " macro, the same error occure.
Does the C++Builder support smart pointer?

Could anyone help me with this ? - thank you

BTW, where can I find some books about com+ program in C++Builder?
I can only get the book with VC++ example.

lingda

 

Re:problem while using smart pointer for Com+ client in C++Builder


This is a bug in BCB. I think there is some missing bit in the library.
I suggest you file a bug report.

Quote
qianhao wrote:

[snip]

Other Threads