I am posting to this thread although the problem I have is a bit different to the original one: when reverse engeneering a class that uses Macros for it's methods only, EA didn't appear to store away the Macros as it should, according to the description given in
http://www.sparxsystems.com/EAUserGuide/index.html?languagemacros.htmAfter some investigation I found out that in those cases the tagged values were not created by EA, the macro was the very first symbol of the method definition. So, a definition like this:
MY_DECL void foo();would be generated into a method without tagged value. A definition like this:
virtual MY_DECL void foo();or this:
static MY_DECL void foo();or this:
void MY_DECL foo();would be generated into a method with tagged value.
Please note that all declaration formats above are valid, even the first one. So EA should be able to read and correctly recognize (and tag!) it.
Moreover, in case you try to tag a __declspec onto a specific variable:
MY_DECL class X {} my_x; // __declspec applies to my_x, not class X!, it is not possible to simply move the MY_DECL symbol right in front of the class name, because that would change the syntax! If you look at this code:
class MY_DECL X {} my_x;the __declspec would apply to the class X, not the variable my_x;
P.S.:
I now found that in two cases the way EA treats __declspec Macro definitions actually creates erroneous code (as in: does not compile correctly!):
1. When a __declspec Macro is used on a constructor, EA will not generate a DeclMacro tagged value for this function! (manually defining that macro after import works though)
2. When a __declspec Macro is used on a method that has a pointer or reference type as a result, the resulting code after 'generate' will not compile correctly, since the DeclMacro symbol will be generated right in front of the method name, with the '*' or '&' symbols yet before that! This does not link correctly under Visual Studio (not sure whether other compilers treat this differently). Example generated code:
void* MY_DECL foo();Under Visual Studio, this warning will be generated:
warning C4518: '__declspec(dllexport ) ' : storage-class or type specifier(s) unexpected here; ignored
While this apparently does compile, the linkage will be wrong.