Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
bad603c6
Commit
bad603c6
authored
Sep 28, 2012
by
Derek Buitenhuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc/platform: Rework the Visual Studio linking section
Signed-off-by:
Derek Buitenhuis
<
derek.buitenhuis@gmail.com
>
parent
08c3156d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
66 deletions
+20
-66
platform.texi
doc/platform.texi
+20
-66
No files found.
doc/platform.texi
View file @
bad603c6
...
@@ -173,79 +173,33 @@ Anything else is not officially supported.
...
@@ -173,79 +173,33 @@ Anything else is not officially supported.
@end itemize
@end itemize
@subsection
Using shared libraries built with MinGW in Visual Studio
@subsection
Linking to FFmpeg with Microsoft Visual C
++
Currently, if you want to build shared libraries on Windows, you need to
If you plan to link with MSVC
-
built static libraries, you will need
use MinGW.
to make sure you have @code
{
Runtime Library
}
set to
@code
{
Multi
-
threaded
(/
MT
)
}
in your project's settings.
This is how to create DLL and LIB files that are compatible with MSVC
++
:
@enumerate
@item Add a call to @file
{
vcvars
32
.bat
}
(
which sets up the environment
variables for the Visual C
++
tools
)
as the first line of @file
{
msys.bat
}
.
The standard location for @file
{
vcvars
32
.bat
}
is
@file
{
C:
\Program
Files
\Microsoft
Visual Studio
8
\VC\bin\vcvars
32
.bat
}
,
and the standard location for @file
{
msys.bat
}
is @file
{
C:
\msys\1
.
0
\msys
.bat
}
.
If this corresponds to your setup, add the following line as the first line
of @file
{
msys.bat
}
:
@example
call "C:
\Program
Files
\Microsoft
Visual Studio
8
\VC\bin\vcvars
32
.bat"
@end example
Alternatively, you may start the @file
{
Visual Studio
2005
Command Prompt
}
,
and run @file
{
c:
\msys\1
.
0
\msys
.bat
}
from there.
@item Within the MSYS shell, run @code
{
lib.exe
}
. If you get a help message
from @file
{
Microsoft
(
R
)
Library Manager
}
, this means your environment
variables are set up correctly, the @file
{
Microsoft
(
R
)
Library Manager
}
is on the path and will be used by FFmpeg to create
MSVC
++-
compatible import libraries.
@item Build FFmpeg with
@example
.
/
configure
--
enable
-
shared
make
make install
@end example
Your install path
(
@file
{
/
usr
/
local
/
}
by default
)
should now have the
necessary DLL and LIB files under the @file
{
bin
}
directory.
@end enumerate
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
@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
}
,
@file
{
libgcc.a
}
, and @file
{
wsock
32
.lib
}
, nor any other external library
statically linked into the DLLs.
FFmpeg headers do not declare global data for Windows DLLs through the usual
FFmpeg headers do not declare global data for Windows DLLs through the usual
dllexport
/
dllimport interface. Such data will be exported properly while
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
appropriate headers and mark the data as dllimport. For example, in
libavutil
/
pixdesc.h you should have:
libavutil
/
pixdesc.h you should have:
@example
@example
extern
__
declspec
(
dllimport
)
const AVPixFmtDescriptor av
_
pix
_
fmt
_
descriptors
[]
;
extern
__
declspec
(
dllimport
)
const AVPixFmtDescriptor av
_
pix
_
fmt
_
descriptors
[]
;
@end example
@end example
Note that using import libraries created by dlltool requires
You will also need to define @code
{
inline
}
to something MSVC understands:
the linker optimization option to be set to
@example
"References: Keep Unreferenced Data
(
@code
{
/
OPT:NOREF
}
)
", otherwise
#define inline
__
inline
the resulting binaries will fail during runtime. This isn't
@end example
required when using import libraries generated by lib.exe.
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
This issue is reported upstream at
@url
{
http:
//
sourceware.org
/
bugzilla
/
show
_
bug.cgi?id
=
12633
}
.
@url
{
http:
//
sourceware.org
/
bugzilla
/
show
_
bug.cgi?id
=
12633
}
.
...
@@ -254,12 +208,12 @@ To create import libraries that work with the @code{/OPT:REF} option
...
@@ -254,12 +208,12 @@ To create import libraries that work with the @code{/OPT:REF} option
@enumerate
@enumerate
@item Open
@emph
{
Visual Studio
2005
Command Prompt
}
.
@item Open
the @emph
{
Visual Studio
Command Prompt
}
.
Alternatively, in a normal command line prompt, call @file
{
vcvars
32
.bat
}
Alternatively, in a normal command line prompt, call @file
{
vcvars
32
.bat
}
which sets up the environment variables for the Visual C
++
tools
which sets up the environment variables for the Visual C
++
tools
(
the standard location for this file is
(
the standard location for this file is
something like
@file
{
C:
\Program
Files
\Microsoft
Visual Studio
8
\VC\bin\vcvars
32
.bat
}
)
.
@file
{
C:
\Program
Files
(
x
86
_
\Microsoft
Visual Studio
10
.
0
\VC\bin\vcvars
32
.bat
}
)
.
@item Enter the @file
{
bin
}
directory where the created LIB and DLL files
@item Enter the @file
{
bin
}
directory where the created LIB and DLL files
are stored.
are stored.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment