[FFmpeg-devel] [RFC] Add exported global variables to import libraries for WIN32

Ramiro Polla ramiro.polla
Wed Oct 6 05:22:04 CEST 2010

On Tue, Oct 5, 2010 at 10:13 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Sep 10, 2010 at 04:39:39PM +0200, Tomas H?rdin wrote:
>> About two months ago I posted a thread
>> (https://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-July/092654.html) regarding importing the global constants libav* export in MSVC (link.exe). Eventually I figured out that importing the globals rather than adding a function would be a better solution. I went with a __declspec(dllimport) solution, which looked OK until M?ns asked whether it'd work on static builds. It didn't.
>> After discussing it on IRC we figured out that it can't be solved in the
>> headers since both static and dynamic libraries might be built at the
>> same time. It seems that what needs to be done is have the generated
> building them at the same time implicates that PIC will be used for static
> libs in some cases while it otherwise would not?
> If yes then this feature is really retarded as it causes performance loss and
> likely without the user realizing it.

It's possible to build win32 shared libraries without PIC.

I couldn't find a clean way to have dllimport for such data, so I
added a note to the documentation. I don't think we should care that
much about this and MSVC since it's a simple one-line change for the
user and the headers won't work out-of-the box anyways
(stdint.h/inttypes.h must be installed), so the user already has to go
through some effort to get it working.

More information about the ffmpeg-devel mailing list