Skip to content

Commit

Permalink
win32: only use dllexport when building DLL
Browse files Browse the repository at this point in the history
If building a static library, marking symbols as dllexport causes them
to be exported from the final executable. For example, run
objdump -x opus_demo.exe on a --disabled-shared build and look for the
export table; there should not be one in a normal Win32 .exe file, but
when linking static libopus, the exe exports all of the opus_* public
functions.

Use the libtool-defined DLL_EXPORT flag to determine whether we are
building a DLL and only specify __declspec(dllexport) in that case.
  • Loading branch information
danielverkamp authored and rillian committed Apr 20, 2016
1 parent 787eee2 commit 6e96173
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/opus_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extern "C" {

#ifndef OPUS_EXPORT
# if defined(WIN32)
# ifdef OPUS_BUILD
# if defined(OPUS_BUILD) && defined(DLL_EXPORT)
# define OPUS_EXPORT __declspec(dllexport)
# else
# define OPUS_EXPORT
Expand Down

0 comments on commit 6e96173

Please sign in to comment.