OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Tomasz Ostaszewski (era680015INTERIA.PL)
Date: Mon May 13 2002 - 07:18:51 CDT

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    This shouldn't be
            return CopyToSafeArray<long>(vpVariance, pVariance);
    ???
    ----- Original Message -----
    From: "Sankar Ramanathan" <sankar.ramanathanRAPISTAN.COM>
    To: <DCOMDISCUSS.MICROSOFT.COM>
    Sent: Monday, May 13, 2002 2:11 PM
    Subject: Re: Debug Error! and Template problem

    > For problem 1 make sure you have the correct version of the proxy-stub dll
    > installed on the client machine.
    >
    > -Sankar
    >
    >
    >
    >
    > Mohammad Saleem <mohammad.saleemMAMEA.SE>DISCUSS.MICROSOFT.COM> on
    > 05/13/2002 02:25:37 AM
    >
    > Please respond to Distributed COM-Based Code <DCOMDISCUSS.MICROSOFT.COM>
    >
    > Sent by: Distributed COM-Based Code <DCOMDISCUSS.MICROSOFT.COM>
    >
    >
    > To: DCOMDISCUSS.MICROSOFT.COM
    > cc:
    > Subject: Debug Error! and Template problem
    >
    >
    > Hi all,
    >
    > I have two problems.
    >
    > problem 1:( Debug Error problem)
    > --------
    > I have built a DCOM object and now I want to test it locally as follow:
    >
    > 1. My test client create the COM object with
    > CoCreateInstance(CLSID_Controller ...) (works fine).
    > 2. Gets a pointer to the interface
    > pUnk->QueryInterface(IID_IController, (LPVOID FAR*) &pController)(works
    > fine)
    > 3. Call a method without argument as below
    > pController->abort(); (works fine and no error).
    >
    > 4. But when I call a method with parameter as below
    > SAFEARRAY* pMean;
    > SAFEARRAY* pVar;
    > pController->getMeanVar(&pMean, &pVar);
    >
    > I get the following error:
    >
    > *********************************
    > "Debug Error!
    > (...)
    > Module:
    > File:i386\chkesp.c
    > The value of ESP was not properly saved across a function call.
    > This is usually a result of calling a function declared with one
    > calling convention with a function pointer declared with a
    > different calling convention."
    > ****************************
    >
    > After reading the mail archive I found that may be by changing the calling
    > covention from __cdecl(which is default project setting) to __stdcall
    might
    > solve my problem.
    > But it didn't help.
    > Is there anybody who can guide me what to do?
    >
    >
    > Problem 2: (Template problem)
    > ---------
    >
    > I have an template function and using it as follow:
    > template <class T>
    > HRESULT
    > CopyToSafeArray(std::vector<T>& in, SAFEARRAY** ppsaOut)
    > {
    > std::vector< T>::iterator iter;
    >
    > *ppsaOut = SafeArrayCreateVector(VT_UI4,0, in.size() );
    >
    > int index = 0;
    > T* tmp = ( T *) (*ppsaOut)->pvData;
    >
    > for (iter = in.begin(); iter < in.end(); iter++)
    > {
    > tmp[index] = *iter;
    > index++;
    > }
    >
    >
    > return S_OK;
    > }
    >
    > STDMETHODIMP
    > CMyClass::GetMeanVar(SAFEARRAY** pMean, SAFEARRAY** pVariance)
    > {
    > .........................
    > ..........................
    > typedef std::vector<long> vpMean(size);
    > return CopyToSafeArray(vpVariance, pVariance);
    > }
    > Compilation works fine but I get error with linking as follow:
    > ******************************************
    > error LNK2001: unresolved external symbol "long __cdecl
    > CopyToSafeArray(class std::vector<long,class std::allocator<long> >
    > &,struct
    > tagSAFEARRAY * *)"
    >
    (?CopyToSafeArrayYAJAAV?$vectorJV?$allocatorJstdstdPAPAUtagSAFEARR
    >
    > AY
    > *********************************************
    >
    > What is going wrong or if there is something I am missing?
    >
    > Any kind of help in this regard.
    > thanks
    > regards
    > /saleem
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >
    > ----------------------------------------------------------------
    > Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    > contains important info. Save time, search the archives at
    > http://discuss.microsoft.com/archives/index.html .
    > To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM
    >
    > ----------------------------------------------------------------------
    > 11-latek w foteliku dzieciecym? >>> http://link.interia.pl/f15c7
    > ----------------------------------------------------------------------
    > INTERIA.PL: Portal pelen informacji
    >
    >
    >

    ----------------------------------------------------------------
    Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
    contains important info. Save time, search the archives at
    http://discuss.microsoft.com/archives/index.html .
    To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM