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

Re: windows static build question


On Monday 10 February 2014 21:57:45 Andreas Schneider wrote:
> 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.

At least I think so, I'm not a Windows developer ;)

> LIBSSH_STATIC should only be set on the compiler commandline compiling the
> source files which use libssh.
> 
> if (WIN32 AND LIBSSH_STATIC_LIB)
>     set_target_properties(
>         ffmpeg
>         PROPERTIES
>         COMPILE_FLAGS
>         "-DLIBSSH_STATIC")
> endif (WIN32 AND LIBSSH_STATIC_LIB)

However this should be the way to use it. I hope you use a 

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


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