[aspectc-user] introductions into sourcefiles

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Wed Feb 1 17:32:31 CET 2006


Hi Martin,

this problem is very strange. I can reproduce that the non-inline member 
function is not woven. However, -v9 shows that the weaver at least tries 
to insert the code.

I have a test program which works and we also use this feature in the 
Puma library.

Somehow your example has to be different...

I'll continue to look into it.

- Olaf


Martin Kuhlemann wrote:
> Hi Olaf,
> 
> I appended an example.
> When I comment out the non-default-constructor of "Client"...all works 
> fine.
> 
> Thank you.
> Martin
> 
> Olaf Spinczyk schrieb:
>> Hi Martin,
>>
>> the mechanism works with any class, because the code is simply 
>> inserted into the .cc and .h file of the target class. The only 
>> condition is that there already has to be a .cc file for the class 
>> that already contains the definition of at least one non-inline member 
>> function or static attribute definition. Otherwise the weaver would 
>> complain.
>>
>> If it still does not work, post  a simple example.
>>
>> - Olaf
>>
>>
>> Martin Kuhlemann wrote:
>>
>>> Hello Olaf,
>>>
>>> thank you for your reply.
>>> Is it possible, that this only works for classes with 
>>> default-constructor?
>>> (Otherwise I get a linker-error, because the method-body got lost.)
>>>
>>> Thank you and best Regards
>>> Martin
>>>
>>> Olaf Spinczyk schrieb:
>>>
>>>> Hello Martin,
>>>>
>>>> here is an example:
>>>>
>>>> aspect Foo {
>>>>   // introduction of the declaration into the class Body of Bar
>>>>   advice "Bar": void func();
>>>> };
>>>>
>>>> // introduction of the implementation, e.g. into Bar.cc
>>>> advice "Bar" : void Foo::func() { ... }
>>>>
>>>> Note that the aspect name "Foo" in "Foo::func" will be replaced by 
>>>> the target class name "Bar" in the generated code.
>>>>
>>>> These "non-inline function introductions" only work if the target 
>>>> class already has a non-inline member function or a static data 
>>>> member, because the introduced non-inline function will be inserted 
>>>> into the same translation unit. If there is no such member, ac++ 
>>>> will stop with an error message.
>>>>
>>>> It is rather likely that the *syntax* of non-inline introductions 
>>>> will change in one of the next ac++ releases. However, the feature 
>>>> will remain.
>>>>
>>>> - Olaf
>>>>
>>>>
>>>> Martin Kuhlemann wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> is there a way to force AspectC++ to divide method-introductions 
>>>>> into header and sourcefile?
>>>>> My code is only compilable by the C++-compiler after I manually put 
>>>>> the introduced methods from the headerfile into the cc-file.
>>>>>
>>>>> Thank you and best Regards.
>>>>> Martin
>>>>> _______________________________________________
>>>>> aspectc-user mailing list
>>>>> aspectc-user at aspectc.org
>>>>> http://www.aspectc.org/mailman/listinfo/aspectc-user
>>>>
>>>>
>>>>
>>>>
>>> _______________________________________________
>>> aspectc-user mailing list
>>> aspectc-user at aspectc.org
>>> http://www.aspectc.org/mailman/listinfo/aspectc-user
>>
>>
>>
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user




More information about the aspectc-user mailing list