[aspectc-user] Object file with aspectc++

s4022129 at mail.inf.tu-dresden.de s4022129 at mail.inf.tu-dresden.de
Fri Feb 29 14:53:27 CET 2008


i would like to use aspects with already generated object file (.o). I
tryied to do that with a simple example. Here is my example:
test.cpp file:

#include <stdio.h>
#include <stdlib.h>

#include "test.h"

int doIt(int x, int y)
	printf("x: %d, y: %d\n",x,y);

int main(int argc,char **argv)
	int x = 6;
	for(int z = 4; z<6; ++z){
		doIt(x, z);
	return 0;

test.h file:

#ifndef _TEST_H
#define _TEST_H

#include <stdio.h>
#include <stdlib.h>

int doIt(int x, int y);

#endif // _TEST_H

test_1.ah file:

#include "test.h"

aspect FirstWriteAfter {

	advice call("% doIt(...)") && args(x,y) : around(int x, int y) {
		printf("BEFORE: FirstWriteAfter, x: %d, y: %d\n",x,y);
		printf("AFTER: FirstWriteAfter, x: %d, y: %d\n",x,y);


Makefile :

.PHONY: all
all : test.o test_1.ah test.h
	cp test.o testStudent.o
	ag++ testStudent.o -a test_1.ah
	g++ testStudent.o -o test

clean :
	rm *.o *~

-First I generated .o file by typing: ag++ -c test.cpp test.h
-Later on I used make command
-It works fine...but if I change aspect file (.ah) only, it doesn't
include that in weaving proccess (when I use make).

I would be very thankful for help.

Best Regards,
Krzysztof Trawinski

More information about the aspectc-user mailing list