dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 488 forks source link

Add support for `-fvisibility=hidden` and `-fvisibility=default` flags #415

Open csabaszigetipix4d opened 5 years ago

csabaszigetipix4d commented 5 years ago

I quote the updated README.md here :

Support for -fvisibility=hidden and -fvisibility=default

Djinni supports both the -fvisibility=hidden and the -fvisibility=default flags.

The symbols that are belonging to the public interfaces that are generated by Djinni are automatically defined to be visible symbols. To achieve this Djinni is marking the generated code with PROJECT_EXPORT. PROJECT_EXPORT is defined in support-lib/djinni_common.hpp. This macro is using the correct attribute specifier for the actual compiler. For more details, please check the macro definition in the support-lib/djinni_common.hpp header. This PROJECT_EXPORT does nothing in case if you are using the -fvisibility=default compiler flag. This PROJECT_EXPORT in case if you are using the -fvisibility=default compiler flag.

Since the generated headers are including this support-lib/djinni_common.hpp, you must distribute it together with your library that is using Djinni.

Windows

For Windows builds, you must define BUILDING_DLL based on your needs. You can define it as a compiler option like -DBUILDING_DLL. For more details, please check the macro definition in the support-lib/djinni_common.hpp header.

xianwen commented 5 years ago

Hi, @csabaszigetipix4d: I noticed you haven't signed the CLA yet, could you please sign it here: https://opensource.dropbox.com/cla/ Thanks a lot!