Board index » cppbuilder » GetObjectDescription: fatal error trying to compile a simple server

GetObjectDescription: fatal error trying to compile a simple server

I tried to follow the exemple:
http://www.Borland.com/techvoyage/articles/BCB4COM/BCB4COM.html
Each time i get messages:
        [C++ Erreur] MyObjectImpl.h(44): E2316 'Lock' is not a member of
'TMyObjectImpl'.
[C++ Erreur] MyObjectImpl.h(44): E2316 'Unlock' is not a member of
'TMyObjectImpl'.
[C++ Erreur] MyObjectImpl.h(44): E2268 Appel une fonction non dfinie
'InternalQueryInterface'.
[C++ Avertis{*word*224}t] MyObjectImpl.h(44): W8074 Structure passe par valeur.
[C++ Erreur] atlcom.h(165): E2316 'SetVoid' is not a member of
'CComObject<TMyObjectImpl>'.
[C++ Erreur] atlcom.h(166): E2316 'InternalFinalConstructAddRef' is not a
member of 'CComObject<TMyObjectImpl>'.
[C++ Erreur] atlcom.h(167): E2316 'FinalConstruct' is not a member of
'CComObject<TMyObjectImpl>'.
[C++ Erreur] atlcom.h(168): E2316 'InternalFinalConstructRelease' is not a
member of 'CComObject<TMyObjectImpl>'.
[C++ Erreur fatale] atlcom.h(170): F1004 Erreur du compilateur interne at
0x125264a with base 0x1200000.

(fatal error at line:
template <class T1>
class CComCreator
{
public:
        static HRESULT WINAPI CreateInstance(void* pv, REFIID riid, LPVOID* ppv)
        {
                _ASSERTE(*ppv == NULL);
                HRESULT hRes = E_OUTOFMEMORY;
                T1* p = NULL;
                ATLTRY(p = new T1(pv))
                if (p != NULL)
                {
                        p->SetVoid(pv);
                        p->InternalFinalConstructAddRef();
                        hRes = p->FinalConstruct();
                        p->InternalFinalConstructRelease();
                        if (hRes == S_OK)
                                hRes = p->QueryInterface(riid, ppv);

So i -manually- added
CComCriticalSection and CComObjectRootBase as ancestor classes of
TMyObjectImpl
And i get the only last error :fatal error...
[C++ Erreur fatale] atlcom.h(1192): F1004 Erreur du compilateur interne at
0x125264a with base 0x1200000.: at line
static LPCTSTR WINAPI GetObjectDescription() {return NULL;}
What is wrong?

        Best Regards

 

Re:GetObjectDescription: fatal error trying to compile a simple server


Ok
I found it:

I had to add (manually) and only:
public CComObjectRootEx<CComSingleThreadModel>,

as ancestor for the class TMyObjectImpl

but why is it not done automatically?

Quote

> So i -manually- added
> CComCriticalSection and CComObjectRootBase as ancestor classes of
> TMyObjectImpl
> And i get the only last error :fatal error...
> [C++ Erreur fatale] atlcom.h(1192): F1004 Erreur du compilateur interne
at
> 0x125264a with base 0x1200000.: at line
> static LPCTSTR WINAPI GetObjectDescription() {return NULL;}
> What is wrong?

>    Best Regards

Other Threads