diff options
author | Ralph Giles <giles@mozilla.com> | 2012-11-29 23:01:27 +0400 |
---|---|---|
committer | Ralph Giles <giles@mozilla.com> | 2012-11-29 23:26:38 +0400 |
commit | 265b6b11a3bdac5356f137d361123f05a6d3b827 (patch) | |
tree | 963009a22e0557db9a646574e9bee99a9991eacb /include | |
parent | 83f8012ca57251b270847490b5e5e0f534644b8a (diff) |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/opus_defines.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/opus_defines.h b/include/opus_defines.h index 049eed3b..94755f37 100644 --- a/include/opus_defines.h +++ b/include/opus_defines.h @@ -63,16 +63,18 @@ extern "C" { /** @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) |