I am the developer of a c++ library on Linux, Windows and osX. Since osX now does not handle properly anonymous exceptions, I considered cleanly marking the symbols that need to be exported. Following these explanations I defined two macros: FOO_API
and FOO_LOCAL
for marking the symbols. Now I have the following problems:
I define each class in its own file (because I don't want 1000+ long files). If class A
is only used in my library, it would make sense to mark it with FOO_LOCAL
. But if class B
has a private member of type A
, and class B
is FOO_API
, then I receive a compiler warning and the linking fails (symbol not found). That seems to defy the whole point of these export attributes. So, what should it be? I mark my class with something like class FOO_LOCAL A {...}
Is this right?
Is there also no way to have all private members local? (since they are private, they are not supposed to be directly accessed) This would make the marking process less tedious...
Finally, when I mark for example my exception classes, it compiles and run properly, but showing the symbols (nm -C -D my_lib.so
) shows that all the symbols are still there...