[aspectc-user] question about aspecting library functions
Hong Yuan
hong at MPI-SoftTech.Com
Tue Jun 24 17:15:07 CEST 2003
Hello,
How can I weave an aspect to the library function printf()
in the following code without using a wrapper function?
#include <stdio.h>
int main()
{
printf("Please aspect me!");
return 0;
}
I tried to use the following aspect to weave the above
code and failed. The string in the advice was not printed
out.
Aspect myAspect {
advice executioon("% printf(...)") : before()
{
printf("I can weave your library function");
}
};
It seems that if we want an aspect to crosscut a function
in a program, we must have that function defined in the
program. But the library functions like printf() are not
defined in any application program :(
One may suggest to add a wrapper function for printf()
in my program. Sorry, that's not what I want.
This question exists not only for using C/C++ default
libraries (such as stdio.h and iostream.h), but also
for using any user-created libraries.
Any suggestion or explaination will be really appreciated!
Thanks,
Hong
More information about the aspectc-user
mailing list