[aspectc-user] Problems with weaving C program
Mikael Björk
mikbj303 at student.liu.se
Wed Apr 21 11:52:47 CEST 2004
Hi
I'm working on a real-time embedded database system called COMET. In this project we are using aspectC++ to add functionality to the database.
Since it is an embedded system we are using C, but while there is no AspectC weaver, we use the AspectC++ weaver. Unfortunately this causes some difficulties.
In some instances we put all the arguments to a function into a struct. That way it is easy to add new arguments with aspects. A problem arises when we want to transfer the values of the introduced arguments on to another struct for another function call within the first function. I illustrate with a brief example:
struct structA
{
int x;
};
struct structB
{
int x;
};
int functionA(structA a)
{
structB b;
b.x = a.x;
return functionB(b);
}
If we for example extend structA and structB with "int y", we would like to weave "b.y = a.y" into the code before the call to functionB, so that our weaved changes to functionB can use the variable y.
As far as I have understood it after some experimentation, I believe that it is not possible to access the arguments of functionA in an advice which happens "before" functionB is "called".
Am I wrong? And if not, is there some nice way around this problem?
Regards,
Mikael Björk
More information about the aspectc-user
mailing list