"Pure Virtual Function Call" 
Author Message
 "Pure Virtual Function Call"

Hi,

I am trying to return a connection information from my com dll to a VB
client.  The connection is established and the connectstring is displayed in
the VB client after which it gives me a runtime error "Pure Virtual function
call".  I am not able to identify this problem.  can anyoone help me out.

Also can anyone give me some tips on how to return variant types to my
client bcos i have to return  a connection info if the connection is
established , else a connectstring has to be sent to the client.

Thanks in advance



Sun, 02 Mar 2003 15:16:11 GMT  
 "Pure Virtual Function Call"

This usually occurs if you have stale typelib getting linked.. Basically, VB
is attempting to make a call to a non existant method( caused either due to
invalid id() list in IDL or having a bad typelib to link to). Try to repro
this problem with a simple C++ client.. See if the call actually comes
through.
To return a variant , Just declare your method to have a [out,retval]
VARIANT*..
And stuff that VARIANT.vt with the right type (VT_DISPATCH, or VT_BSTR) and
fill the right union val( .bstrVal or pDispVal (??)).

--
Girish Bharadwaj

Quote:
> Hi,

> I am trying to return a connection information from my com dll to a VB
> client.  The connection is established and the connectstring is displayed
in
> the VB client after which it gives me a runtime error "Pure Virtual
function
> call".  I am not able to identify this problem.  can anyoone help me out.

> Also can anyone give me some tips on how to return variant types to my
> client bcos i have to return  a connection info if the connection is
> established , else a connectstring has to be sent to the client.

> Thanks in advance



Sun, 02 Mar 2003 20:55:52 GMT  
 "Pure Virtual Function Call"

Thanks for your tip on variant.
But I am not able to solve the  "pure virtual function call error"
In fact I get this error when I try to return a connection object.
This is the code i entered

STDMETHODIMP CeutTest::getConnection(BSTR ConnectString, _Connection **conn)
{
 // TODO: Add your implementation code here
 char *constring="";
 constring = (char *)ConnectString;

 if (strlen(constring) != 0)
 {
  _ConnectionPtr a;
  a.CreateInstance(__uuidof(Connection));
  a->Open(_T(ConnectString),_T(""),_T(""),-1);

  *conn.CreateInstance(__uuidof(Connection));
  *conn = a;
 }
 else
 {
  *conn = NULL;

 }
 return S_OK;

Quote:
}

Can anyone tell me what is this problem.

Thanks
Sujatha


Quote:
> This usually occurs if you have stale typelib getting linked.. Basically,
VB
> is attempting to make a call to a non existant method( caused either due
to
> invalid id() list in IDL or having a bad typelib to link to). Try to repro
> this problem with a simple C++ client.. See if the call actually comes
> through.
> To return a variant , Just declare your method to have a [out,retval]
> VARIANT*..
> And stuff that VARIANT.vt with the right type (VT_DISPATCH, or VT_BSTR)
and
> fill the right union val( .bstrVal or pDispVal (??)).

> --
> Girish Bharadwaj


> > Hi,

> > I am trying to return a connection information from my com dll to a VB
> > client.  The connection is established and the connectstring is
displayed
> in
> > the VB client after which it gives me a runtime error "Pure Virtual
> function
> > call".  I am not able to identify this problem.  can anyoone help me
out.

> > Also can anyone give me some tips on how to return variant types to my
> > client bcos i have to return  a connection info if the connection is
> > established , else a connectstring has to be sent to the client.

> > Thanks in advance



Mon, 03 Mar 2003 03:00:00 GMT  
 "Pure Virtual Function Call"

Try to do like this:
STDMETHODIMP CeutTest::getConnection(BSTR ConnectString, _Connection **conn)
 {
  // TODO: Add your implementation code here
  char *constring="";
  constring = (char *)ConnectString;
  HRESULT hr = S_OK;

  if (strlen(constring) != 0)
  {
   _ConnectionPtr a;
   a.CreateInstance(__uuidof(Connection));
   a->Open(_T(ConnectString),_T(""),_T(""),-1);

   hr = a.QueryInterface(__uuidof(_connection),(void **)Conn)
  }
  else
  {
   hr = E_INVALIDARG;
    //Don't try to set Conn = NULL directly, return a hr with a error
information
   // is enough.

  }
  return hr;
 }

 I wish it will help u.


Quote:
> Thanks for your tip on variant.
> But I am not able to solve the  "pure virtual function call error"
> In fact I get this error when I try to return a connection object.
> This is the code i entered

> STDMETHODIMP CeutTest::getConnection(BSTR ConnectString, _Connection
**conn)
> {
>  // TODO: Add your implementation code here
>  char *constring="";
>  constring = (char *)ConnectString;

>  if (strlen(constring) != 0)
>  {
>   _ConnectionPtr a;
>   a.CreateInstance(__uuidof(Connection));
>   a->Open(_T(ConnectString),_T(""),_T(""),-1);

>   *conn.CreateInstance(__uuidof(Connection));
>   *conn = a;
>  }
>  else
>  {
>   *conn = NULL;

>  }
>  return S_OK;
> }

> Can anyone tell me what is this problem.

> Thanks
> Sujatha



> > This usually occurs if you have stale typelib getting linked..
Basically,
> VB
> > is attempting to make a call to a non existant method( caused either due
> to
> > invalid id() list in IDL or having a bad typelib to link to). Try to
repro
> > this problem with a simple C++ client.. See if the call actually comes
> > through.
> > To return a variant , Just declare your method to have a [out,retval]
> > VARIANT*..
> > And stuff that VARIANT.vt with the right type (VT_DISPATCH, or VT_BSTR)
> and
> > fill the right union val( .bstrVal or pDispVal (??)).

> > --
> > Girish Bharadwaj


> > > Hi,

> > > I am trying to return a connection information from my com dll to a VB
> > > client.  The connection is established and the connectstring is
> displayed
> > in
> > > the VB client after which it gives me a runtime error "Pure Virtual
> > function
> > > call".  I am not able to identify this problem.  can anyoone help me
> out.

> > > Also can anyone give me some tips on how to return variant types to my
> > > client bcos i have to return  a connection info if the connection is
> > > established , else a connectstring has to be sent to the client.

> > > Thanks in advance



Mon, 14 Apr 2003 14:18:25 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. pure virtual function and virtual function

2. Pure Virtual Function Call (R0625)

3. runtime error: pure virtual function call

4. Pure Virtual Function Call (Help!)

5. Runtime error! R6025 pure virtual function call

6. URGENT : How to debug runtime error "r6025 Pure virtual function call"

7. pure virtual function call (VC++,COM)

8. Trapping calls to pure virtual functions - how ?

9. Pure virtual function call problem - Win32

10. R6025 -- Pure Virtual Function Call

11. pure virtual function call and ATL

12. debugging pure virtual function call error

 

 
Powered by phpBB® Forum Software