[aspectc-user] introductions into sourcefiles

Martin Kuhlemann martin.kuhlemann at web.de
Mon Jan 30 13:59:49 CET 2006


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
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.zip
Type: application/x-zip-compressed
Size: 948 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20060130/91573fb6/attachment.bin>


More information about the aspectc-user mailing list