[FFmpeg-devel] Fix libssh static linkage on Windows

Matt Oliver protogonoi at gmail.com
Wed Feb 5 00:55:00 CET 2014


Currently unless told to do otherwise libssh.h will automatically set all
declarations to dllimport linkage. This means it is not possible to link
against libssh statically. Previously I dont think this has been a problem
as due to libssh's cmake it creates shared libraries by default. But if you
manually specify static linking it is currently not possible to link on
Windows.

This patch fixes this by simply adding a define before the inclusion of the
libssh header file that disables automatically setting dllimport. With this
static linkage will work. Shared linkage still works as the shared lib
(libssh.dll.a etc.) is still included during linking and so the dllimport
are handled explicitly there instead.

This is a single line patch that allows for both static and shared linage
to now work with libssh on Windows. Tested with MinGW and msvc/icl. This
patch has no affect on any other platforms.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix-libssh-defaulting-to-shared-linkage.patch
Type: application/octet-stream
Size: 584 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140205/1852fa6d/attachment.obj>


More information about the ffmpeg-devel mailing list