[FFmpeg-cvslog] doc/platform: Rework the Visual Studio linking section
Derek Buitenhuis
git at videolan.org
Sat Sep 29 14:46:46 CEST 2012
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Fri Sep 28 01:52:34 2012 +0000| [7d1d4469902bbbdcb225eedd64f84c884cffbc2d] | committer: Derek Buitenhuis
doc/platform: Rework the Visual Studio linking section
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d1d4469902bbbdcb225eedd64f84c884cffbc2d
---
doc/platform.texi | 61 ++++++++++++++++++-----------------------------------
1 file changed, 20 insertions(+), 41 deletions(-)
diff --git a/doc/platform.texi b/doc/platform.texi
index a16bb46..3bb9f79 100644
--- a/doc/platform.texi
+++ b/doc/platform.texi
@@ -167,54 +167,33 @@ Anything else is not officially supported.
@end itemize
- at subsection Using shared libraries built with MinGW in Visual Studio
+ at subsection Linking to Libav with Microsoft Visual C++
-Currently, if you want to build shared libraries on Windows, you need to
-use MinGW.
-
-This is how to create DLL and LIB files that are compatible with MSVC++:
-
-Within the MSYS shell, build Libav with
-
- at example
-./configure --enable-shared
-make
-make install
- at end example
-
-Your install path (@file{/usr/local/} by default) should now have the
-necessary DLL and LIB files under the @file{bin} directory.
-
-Alternatively, build the libraries with a cross compiler, according to
-the instructions below in @ref{Cross compilation for Windows with Linux}.
-
-To use those files with MSVC++, do the same as you would do with
-the static libraries, as described above. But in Step 4,
-you should only need to add the directory where the LIB files are installed
-(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are
-installed in the @file{bin} directory. And instead of adding the static
-libraries (@file{libxxx.a} files) you should add the MSVC import libraries
-(@file{avcodec.lib}, @file{avformat.lib}, and
- at file{avutil.lib}). Note that you should not use the GCC import
-libraries (@file{libxxx.dll.a} files), as these will give you undefined
-reference errors. There should be no need for @file{libmingwex.a},
- at file{libgcc.a}, and @file{wsock32.lib}, nor any other external library
-statically linked into the DLLs.
+If you plan to link with MSVC-built static libraries, you will need
+to make sure you have @code{Runtime Library} set to
+ at code{Multi-threaded (/MT)} in your project's settings.
Libav headers do not declare global data for Windows DLLs through the usual
dllexport/dllimport interface. Such data will be exported properly while
-building, but to use them in your MSVC++ code you will have to edit the
+building, but to use them in your MSVC code you will have to edit the
appropriate headers and mark the data as dllimport. For example, in
libavutil/pixdesc.h you should have:
@example
extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
@end example
-Note that using import libraries created by dlltool requires
-the linker optimization option to be set to
-"References: Keep Unreferenced Data (@code{/OPT:NOREF})", otherwise
-the resulting binaries will fail during runtime. This isn't
-required when using import libraries generated by lib.exe.
+You will also need to define @code{inline} to something MSVC understands:
+ at example
+#define inline __inline
+ at end example
+
+Also note, that as stated in @strong{Microsoft Visual C++}, you will need
+an MSVC-compatible @uref{http://code.google.com/p/msinttypes/, inttypes.h}.
+
+If you plan on using import libraries created by dlltool, you must
+set @code{References} to @code{No (/OPT:NOREF)} under the linker optimization
+settings, otherwise the resulting binaries will fail during runtime.
+This is not required when using import libraries generated by @code{lib.exe}.
This issue is reported upstream at
@url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}.
@@ -223,12 +202,12 @@ To create import libraries that work with the @code{/OPT:REF} option
@enumerate
- at item Open @emph{Visual Studio 2005 Command Prompt}.
+ at item Open the @emph{Visual Studio Command Prompt}.
Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
which sets up the environment variables for the Visual C++ tools
-(the standard location for this file is
- at file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}).
+(the standard location for this file is something like
+ at file{C:\Program Files (x86_\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat}).
@item Enter the @file{bin} directory where the created LIB and DLL files
are stored.
More information about the ffmpeg-cvslog
mailing list