[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: windows static build question


On Monday 10 February 2014 20:55:47 Lukasz M wrote:
> Hello,

Hi Lukasz,
 
> I'm contributor of ffmpeg project. We have support for sftp via libssh
> library.
> 
> Recently we got a patch that defines LIBSSH_STATIC before including
> libssh's header.
> This is a link to the full thread on our mailing list
> http://ffmpeg.org/pipermail/ffmpeg-devel/2014-February/153993.html
> 
> Patch looks like this:
> 
> +#define LIBSSH_STATIC

libssh uses symbol hiding to make the library smaller and export only public 
functions. By default the functions define with LIBSSH_API are public and it 
is set to

#define LIBSSH_API __declspec(dllimport)


for static linking you need to unset it, so you need LIBSSH_STATIC. Setting 
this in a header file is normally a bad idea cause then only static linking is 
possible.


>  #include <libssh/sftp.h>
> 
> This supposed to fix static linking on windows.
> Macro is added unconditionaly and we wonder if using it for
> dynamic libs on windows or outside windows is safe, unsafe or undefined.

LIBSSH_STATIC should only be set on the compiler commandline compiling the 
source files which use libssh.

if (WIN32)
    set_target_properties(                                                                                                                                                          
        ffmpeg
        PROPERTIES
        COMPILE_FLAGS
        "-DLIBSSH_STATIC")                                                                                                                                                                               
endif (WIN32)


Best regards,


	-- andreas


-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx


Follow-Ups:
Re: windows static build questionAndreas Schneider <asn@xxxxxxxxxxxxxx>
References:
windows static build questionLukasz M <lukasz.m.luki@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org