[aspectc-user] calls to members through a pointer to member

Panu Bloigu panu.bloigu at gmail.com
Wed Nov 28 12:24:56 CET 2007


Hello.

It seems that ag++ currently can't trap calls to member methods if the 
member is called through a pointer-to-member, e.g.:


=============================================================
void (Base::* ptr_to_member)() = &Base::some_method;
Base b;
(b.*ptr_to_member)(); // Trap this call...

// with this advice:
advice call("void Base::some_method()") : before(){/* ... */}
=============================================================

Same seems to go for function calls occurring through a 
pointer-to-function.

Is this correct, or do I need to use some special match expression in 
the call() join point function argument to trap function/method calls 
occurring through a pointer-to-function/pointer-to-member?

If this indeed is possible, and I'm doing something wrong, it would be 
interesting to hear how this feature is implemented. As far as I can 
see, weaver has to somehow gain awareness of the actual value (the 
pointed-to function/method) of a pointer-to-function/pointer-to-member 
to be able to tell the target of the call.

--Panu



More information about the aspectc-user mailing list