[aspectc-user] AspectC++ and Nokia/Trolltech Qt

Alessandro Bottoni alexbottoni at yahoo.it
Tue Feb 1 20:03:41 CET 2011


Il 01/02/2011 18:15, Olaf Spinczyk ha scritto:
>> Is it possible to use AspectC++ with Qt?
> Yes, it is possible, even though some of the Qt header files cause parse
> errors. At the moment 171 out of 220 standard examples from the Qt 4.7.0
> distribution can be compiled with ag++ without errors (latest version
> from the subversion repository). The remaining 49 examples are work in
> progress.

Very good!

> For experimenting with it, run qmake with "QMAKE_CXX=ag++ --Xcompiler"
> (including the quotes). Then the generated Makefile will call ag++
> instead of g++ for compilation of all translation units. Please note
> that this simple integration approach does not handle file dependencies
> correctly. If you change any aspect header file, you need to recompile
> the whole project manually (make clean && make). If you know a good
> solution for this issue, please let me know. ;-)

Thanks for the info. I'll experiment with AspectC++ and the Qt in the 
next few days and let you know what happens.

>> Qt uses its own reflection technology based on macros and a specific
>> pre-processor (MOC: Meta-Objects Compiler) that produces common C++
>> code. Does this technology interfere with the AspectC++ mechanism?
> Yes, this is indeed a bit problematic. Because ac++ cannot manipulate
> macro-generated code, several generated functions have to be excluded
> from your pointcut expressions as in the following example:
>
> ---
> // these functions are created by moc and have macro-generated declarations
> pointcut moc_gen() =
> "const QMetaObject & %::getStaticMetaObject()" ||
> "const QMetaObject * %::metaObject()" ||
> "void * %::qt_metacast(const char *)" ||
> "int %::qt_metacall(QMetaObject::Call, int, void **)";
>
> aspect TestExecution {
> // advice for all but the generated functions
> advice execution("% ...::%(...)" && !moc_gen()) : before () {
> ...
> }
> };
> ---

OK

>>
>> And, last but not least: the most recent messages of this ML dates
>> back to July 2010, the last release of the library (1.0pre3) dates
>> back to 2006 and the last announcement on the AspectC++ wen sites
>> dates back to 2007.
>>
>> Is the AspectC++ project still alive?
> Yes, we're alive! ;-)
>
> Frankly speaking, I can understand that the project appears to be dead.
> I haven't had time to update the web site and roll out releases for too
> long. However, if you check the svn logs, you'll see that we've
> continuously improved the parser and the weaver. There were also some
> updates of the debian and ubuntu packages of AspectC++. Right now the
> project is gaining more speed.

It's all right. I just wanted to be sure to not waste my time on a 
project that was could be already known for being abandoned since a long 
time.

>>
>> Is AspectC++ code still maintained and safe to use in real-world
>> projects?
> Well, this is something nobody can promise. The code is maintained, but
> AspectC++ is an open source project and not an expensive commercial
> thing. It has to be used with care and some good will.

OK, fine. Actually, commercial products are not always better than FOSS...

>
> PS: If you let me know which platform you are using, I will send you the
> latest binaries.

Many thanks, this would allow me to make some quick experiments and see 
if/how I can use ac++ in my projects.

I'm using a Linux Mint 10 Julia distro (a Ubuntu 10.10 Maverick Merkaat 
derivative) with Qt 4.7.0 installed via synaptic form the Canonical 
repository.

Thanks again for you kind help and your quick response.

-- 

Alessandro Bottoni
Website: http://www.alessandrobottoni.it/

"They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety."
      -- Benjamin Franklin, Historical Review of Pennsylvania, 1759



More information about the aspectc-user mailing list