[aspectc-user] LNK2005 with woven Codes

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Tue Oct 24 05:08:12 CEST 2006


Hello Yan,

to be honest, your description of the problem is not very precise and I
have no chance to reproduce the misbehavior.

If both advices are defined in the same aspect and if you don't define
your own aspect instantiation strategy with "aspectof()", I don't see a
reason why there should be two aspect instances. Or do you use some
special linker that has no "COMDAT-support"? Could you send me more
information about your build environment? If it helps, you could also
write in german.

- Olaf

Yan Mao wrote:
> Hallo Olaf,
>
> thanks for the answer. I changed my codes, and they worked now well. 
>
> But as I tried to use the same aspect in another project, I got another problem.  
>  
> In my aspect,I want to break an action, if the execution time expands.
>
> In an advice of one pointcut I set the "start time", and in the other advice of another pointcut, i'd like to read the "start time", so that i can compare the "current time" with the "start time". 
>
> But unfortunately, i cant get the setted start time. 
>
> It seemes that, 2 Aspect object are created in der Laufzeit, where only one object should be created. That's why I cant get the set value.
>
> Actually the AC woven codes are almost the same with the sample project, which worked well. But They just don't work!
>
> To notice, that my current project are build on a system, which wraps the Visual Studio APIs and Libraries, and offers its own APIs. And I must also use its own Compiler to compile and link the projects, which should call VS compiler cl.exe internally. 
>
> I suppose that it has somthing to with the compiler, but i dont know how to get the wright way to solve the problem.
>
> Can you give me some tipps?
> Sorry for my poor English, if it is hard to read. But I really need help!
>
> Thanks in advance,
> Yan
>  
>
>
> -------- Original-Nachricht --------
> Datum: Sun, 22 Oct 2006 08:20:11 +0200
> Von: Olaf Spinczyk <Olaf.Spinczyk at informatik.uni-erlangen.de>
> An: Yan Mao <maoyan at gmx.net>
> Betreff: Re: [aspectc-user] LNK2005 with woven Codes
>
>   
>> Hello Yan,
>>
>> it looks as if you defined the member functions of "Profiling" as
>> non-inline functions in the aspect header file. If the aspect affects
>> more than one translation unit, the code will be generated more than
>> once and the linker complains. Better define the small functions as
>> inline functions.
>>
>> Best regards,
>>
>> Olaf
>>
>> Yan Mao wrote:
>>     
>>> Hello,
>>>
>>> I got LNK2005 errors by linking the woven codes.
>>> it seems to me, that the same aspect is expanded in multiple cpp files.
>>>
>>> I have #ifndef #define and #endif macros in every head file, and I also
>>>       
>> notice that AC++ compiler generate constant names  such as
>>     
>>> __ac_have_C__DA_ACSTUTest_aspects_Profiling_ah__
>>> __ac_need_C__DA_ACSTUTest_aspects_Profiling_ah__
>>>
>>> But they still dont work. What's wrong with my codes?
>>>
>>> I'd like to post the sample codes, hope anyone can help me!
>>>
>>> thanks in advance!!
>>>
>>> Yan
>>>   
>>>       
>
>   




More information about the aspectc-user mailing list