ref: 265b6b11a3bdac5356f137d361123f05a6d3b827
parent: 83f8012ca57251b270847490b5e5e0f534644b8a
author: Ralph Giles <[email protected]>
date: Thu Nov 29 06:01:27 EST 2012
Allow the build files to override OPUS_EXPORT. OPUS_EXPORT was conditionalized on OPUS_BUILD, so that symbols are export based on public header declarations when building opus as a library, but not when those headers are included in other programmes. This doesn't address the case when the opus source and its caller are both included in the same monolithic build. In that case we want to define OPUS_BUILD, to indicate that we are compiling the codec source, but not export the symbols. To support this, only define OPUS_EXPORT if it is not already defined. This allows build scripts to -DOPUS_EXPORT and override the platform-specific attribute decortation in opus_defines.h. Based on a patch by Sergey Ulanov. http://git.chromium.org/gitweb/?p=chromium/deps/opus.git;a=commitdiff;h=6304b9628cb7244e3cc78f740aeb6659562f1857
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -63,16 +63,18 @@
/** @cond OPUS_INTERNAL_DOC */
/**Export control for opus functions */
-#if defined(__GNUC__) && defined(OPUS_BUILD)
-# define OPUS_EXPORT __attribute__ ((visibility ("default")))
-#elif defined(WIN32) && !defined(__MINGW32__)
-# ifdef OPUS_BUILD
+#ifndef OPUS_EXPORT
+# if defined(__GNUC__) && defined(OPUS_BUILD)
+# define OPUS_EXPORT __attribute__ ((visibility ("default")))
+# elif defined(WIN32) && !defined(__MINGW32__)
+# ifdef OPUS_BUILD
# define OPUS_EXPORT __declspec(dllexport)
-# else
+# else
# define OPUS_EXPORT
+# endif
+# else
+# define OPUS_EXPORT
# endif
-#else
-# define OPUS_EXPORT
#endif
# if !defined(OPUS_GNUC_PREREQ)