Board index » cppbuilder » Implementing event sink for SAPI 5.1 and a linker error

Implementing event sink for SAPI 5.1 and a linker error

I am trying to catch the events of SAPI 5.1 and I have implemented event
sinks in my class TTTSSink:

typedef void __fastcall (__closure* TTTSStartStream)(long StreamNumber,
TVariantInParam StreamPosition);
//--------------------------------------------------------------------------
-
class TTTSSink : public TEventDispatcher<TTTSSink,
&DIID__ISpeechVoiceEvents>
{
protected:
        /* event field */
        TTTSStartStream FOnTTSStartStream;

        /* event dispatcher */
        HRESULT InvokeEvent(DISPID id, TVariant* params)
        {
                /* VCL forwarding */
                if((id == 1)&&(FOnTTSStartStream != NULL))
                        FOnTTSStartStream(params[0], params[1]);

                return S_OK;
        }

        /* event sender reference */
        CComPtr<IUnknown> m_pSender;
public:
        /* connect to server */
        HRESULT Connect(IUnknown* pSender)
        {
                if(pSender != m_pSender)m_pSender = pSender;
                if(NULL != m_pSender)return ConnectEvents(m_pSender);
                return S_OK;
        }

        /* disconnect from server */
        void Disconnect()
        {
                if(NULL != m_pSender)
                {
                        DisconnectEvents(m_pSender);
                        m_pSender = NULL;
                }
        }

        /* event defs */
        __property TTTSStartStream OnTTSStartStream = {read =
FOnTTSStartStream, write = FOnTTSStartStream};

        /* class defs */
        TTTSSink() : m_pSender(NULL), FOnTTSStartStream(NULL){};
        virtual ~TTTSSink(){Disconnect();};

Quote
};

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

However, when I call the TTTSSink class in my cpp source, I am getting
unresolved external '__fastcall COMHlpr_DisconnectEvents(const _GUID&,
IUnknown*, unsigned long&)' referenced from ... *.obj

What am I missing?

T. Alex.

 

Re:Implementing event sink for SAPI 5.1 and a linker error


I found the problem. Alex

Other Threads