Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Martin Wawro on August 20, 2012, 07:07:22 pm

Title: Conditional Compilation in C++ Reverse Eng.
Post by: Martin Wawro on August 20, 2012, 07:07:22 pm
Hi,

I am working at a multi-platform project and I basically want to generate models from C++ sources for a special platform. The platform-specific stuff is usually put in conditionals (#ifdef). It seems that EA ignores them (seems they always evaluate to true).

Is there any way to teach EA not to consider code in #ifdefs ?

Title: Re: Conditional Compilation in C++ Reverse Eng.
Post by: Wyatt on August 21, 2012, 07:56:29 am
A workaround that MAY get you over the line..

Use your C++ compiler to output pre-processed source code.  You should then be able to reverse engineer the resulting source code using the standard mechanism and (hopefully!) get the results you're after.

See:
http://stackoverflow.com/questions/277258/c-c-source-file-after-preprocessing

HTH
Title: Re: Conditional Compilation in C++ Reverse Eng.
Post by: Martin Wawro on August 21, 2012, 06:45:08 pm
Yes, this is the workaround I also had in mind. It would have been nice though if EA would support this out of the box. Pity.
Title: Re: Conditional Compilation in C++ Reverse Eng.
Post by: Eve on August 22, 2012, 09:00:11 am
It can be done, but it's not trivial enough to explain here. Contact sparx support and they'll be able to help you.
Title: Re: Conditional Compilation in C++ Reverse Eng.
Post by: olli_s on August 22, 2012, 04:08:54 pm
I wonder if the explanation could be placed into a white paper if it is too complex. I suggest that many users have the same problem. :-?