[aspectc-user] Usage of AspectC++ was: Question: how does ac++ link library?

Danilo Beuche danilo.beuche at pure-systems.com
Fri Mar 7 19:05:13 CET 2003


since ac++ does a source-to-source compilation/transformation from AC++ 
to C++, the output of ac++ is pure C++. You have to use your favorite 
compiler to actually compile this output to .o-files or executables.

The usage of AspectC++ requires several steps:

1. put all source code which should be "aspectized" and the aspect code
   in a directory (called PROJECT_DIR from now).

2. transform your aspect code from AspectC++ to C++


    this will create PROJECT_OUTPUTDIR if it does not exist and puts the
    generated source code into this directory.
    If your C++ files do not the suffix "cc", you have to use the -e
    option (See AspectC++ Announcement 0.7pre1 for informations on -e
    usage). You have to give ac++ all your -I and -D options your
    compiler requires in step 3.

3. Put the makefile for your  project into PROJECT_OUTPUTDIR. The
   makefile should call the normal compiler, e.g. g++ in the usual way.
   Here goes your -l option.
   If you see an ac_gen.cc (generated from ac++) , you have compile this
   file too, and link it to your application/put it in your lib.

   An example call to g++ could look like this (assuming your program is
   implemented in "my_app.cc":

       g++ -o my_app my_app.cc ac_gen.cc -LSUPER_LIB_DIR -lsuper_lib 

- Run your aspectized app :-)


Look at the "test" section of the supplied Makefile in the AspectC++
tar/zip to see our example build rules.


Hong Yuan wrote:
> Hello
> For now ac++ doesn't allow using -l option and -L option
> for linking library, while we usually use these options
> for linking in gcc/g++. If I want to use ac++ to compile
> my source files which include some functions defined in
> such libraries as <pthead.h>, how can I link the libraries
> in command-line? Does AspectC++ 0.7pre improve this?

> Thanks,
> Hong Yuan
> MPI Software Technology, Inc.
> Ph:  +1-(662)320-4300 ext 30
> Fax: +1-(662)320-4301
> http://mpi-softtech.com
> The information contained in this communication may be confidential
> and is intended only for the use of the recipient(s) named above.
> If the reader of this communication is not the intended recipient(s),
> you are hereby notified that any dissemination, distribution, or
> copying of this communication, or any of its contents, is strictly
> prohibited. If you are not a named recipient or received this
> communication by mistake, please notify the sender and delete the
> communication and all copies of it.
> _______________________________________________
> 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