Re: C++ Draw Callback?

New Message Reply Date view Thread view Subject view Author view

Christopher R Volpe (volpe++at++ash.crd.ge.com)
Fri, 06 Dec 1996 16:59:37 -0500


Hansong Zhang wrote:
>
>
> The same thing can be done to non-static member functions, also.
> But you need a explicit type conversion:
>
> chan->setTravFunc( PFTRAV_DRAW, (pfChanFuncType)MyClass::DrawChannel );
>
> You'll still get an warning about this conversion, but you could
> ignore that...

No you can't. Non-static member functions have a "this" pointer passed
in behind the scenes as part of the calling convention. If you try to
invoke the member function as if it were an ordinary function, it will
crash immediately if you're lucky, and deceptively appear to work, for
now, if you're unlucky. What will likely happen is that your member
function will think that the pfChannel* parameter passed in by performer
is actually the this-pointer, and will think that the void* parameter
passed in is atually the pfChannel* parameter, leaving the void*
parameter undefined within the member function, and it all goes downhill
from there...

--

Chris Volpe Phone: (518) 387-7766 GE Corporate R&D Fax: (518) 387-6560 PO Box 8 Email: volpecr++at++crd.ge.com Schenectady, NY 12301 Web: http://www.crd.ge.com/~volpecr ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:06 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.