- To: Xin Tong <xerox.time.tech@xxxxxxxxx>
- Subject: Re: calling a C++ member function
- From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
- Date: Wed, 13 Jun 2012 13:51:02 +0100
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <CALKntY2eCA+UVNY9eiN=6pSEQ46pbpKp1FKgV3vGHS__mGevWw@mail.gmail.com>
On Jun 13, 2012 11:56 AM, "Xin Tong" wrote:
>
> Function pointers can be used to call functions in C. but for C++
> member functions. A special function pointer needs to be used, i.e.
>
> float (SomeClass::*my_memfunc_ptr)(int, char *);
>
> but eventually, my_memfunc_ptr will hold the address of the code of
> the function it points to. can i set up the calling context myself at
> this point, i.e. put "this" pointer into rdi, put the arguments into
> other registers/stacks and jump to the address held in the
> my_memfunc_ptr. would this work in gcc compiled code , what about
> other compilers and os linkages ?
Have you seen http://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html ?
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]