[opus] libopusfile win32 dll (MSVC)

Timothy B. Terriberry tterribe at xiph.org
Mon Feb 17 16:00:52 PST 2014

r webby wrote:
> So, do i need to #define dllimport/export those libopusfile functions
> myself? I could swear Ive seen a mingw dynamic library version, and Im
> pretty sure mingw also requires a .def file and the #defines, so Im
> guessing I've just missed something here.

I don't think you need the #defines, just the .def file. That file takes 
the place of declaring things dllexport. Declaring things dllimport 
merely avoids calling them through a thunk, but the number of entry 
points into libopusfile is small enough that this overhead is 
inconsequential. Easier to just avoid the whole mess of trying to decide 
if you're compiling the DLL or something using the DLL, etc.

I believe the mingw DLLs are taking these attributes from GCC's 
visibility pragmas. For our other libraries, like libtheora, we've used 
an explicit .def file and then used that to auto-generate a linker 
script on other platforms, but nobody has replicated this build 
infrastructure for libopusfile. The pragmas were just an expedient way 
to get stuff going.

So the short answer is: you need a .def file, but no one has made one 
for you yet.

More information about the opus mailing list