[aspectc-user] question about aspecting library functions

Danilo Beuche danilo.beuche at pure-systems.com
Wed Jun 25 17:31:39 CEST 2003


Hi Hong,


the bugzilla numbers for your problem(s) are:

https://www.aspectc.org/bugzilla/show_bug.cgi?id=107
(the external advice problem, fixed, will be in 0.7)

https://www.aspectc.org/bugzilla/show_bug.cgi?id=106
(the varargs problem, still open)

Danilo


Hong Yuan wrote:
> 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
> 
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
> 


-- 
Danilo Beuche                           Phone: +49-391-54456910
pure-systems GmbH                       Fax:   +49-391-54456990




More information about the aspectc-user mailing list