Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Language Macros

When reverse engineering a language such as C++, you might find preprocessor directives scattered throughout the code. This can make code management easier, but can hamper parsing of the underlying C++ language.

To help remedy this, you can include any number of macro definitions, which are ignored during the parsing phase of the reverse engineering. It is still preferable, if you have the facility, to preprocess the code using the appropriate compiler first; this way, complex macro definitions and defines are expanded out and can be readily parsed. If you don't have this facility, then this option provides a convenient substitute.

Access     Project | Settings | Preprocessor Macros

Define a macro



See also


Select the Preprocessor Macros menu option.

The Language Macros dialog displays.




Click on the Add New button.




Enter details for your macro.




Click on the OK button.






See also

Macros Embedded Within Declarations

Macros are sometimes used within the declaration of Classes and operations, as in the following examples:

class __declspec Foo


 int __declspec Bar(int p);



If declspec is defined as a C++ macro, as outlined above, the imported Class and operation contain a Tagged Value called DeclMacro1 with value __declspec (subsequent macros would be defined as DeclMacro2, DeclMacro3 and so on).

During forward engineering, these Tagged Values are used to regenerate the macros in code.



Define Complex Macros

It is sometimes useful to define rules for complex macros that can span multiple lines;Enterprise Architect ignores the entire code section defined by the rule.

Such macros can be defined in Enterprise Architect as in the following two examples; both types can be combined in one definition.

Block Macros




The ^ symbol represents the body of the macro - this enables skipping from one macro to another; the spaces surrounding the ^ symbol are required.

Function Macros




Enterprise Architect skips over the token including everything inside the parentheses.




·You can transport these language macro (or preprocessor macro) definitions between models, using the Project | Data Management | Export Reference Data and Import Reference Data options; the macros are exported as a Macro List

Learn more