Boost logo

Boost-Build :

Subject: Re: [Boost-build] EXE linking with DLLs
From: Nogradi, Chris (Chris.Nogradi_at_[hidden])
Date: 2011-11-30 16:24:03


Thanks Matt!

I did not have opportunity to try your suggestion out yet since it would require me to re-architect many jam files. What I ended up doing is to modify targets.jam line 1421 like so:

        # TODO - Actually there are more possible candidates like for instance
        # when listing static library X as a source for another static library.
        # Then static library X will be added as a <source> property to the
        # second library's usage requirements but those requirements should last
        # only up to the first executable or shared library that actually links
        # to it.
        local raw = [ $(subvariant).sources-usage-requirements ] ;
        raw = [ $(raw).raw ] ;
        raw = [ property.change $(raw) : <pch-header> ] ;
        raw = [ property.change $(raw) : <pch-file> ] ;

          # remove libraries from shared link targets
        if [ $(rproperties).get <link> ] = shared
        {
            raw = [ property.change $(raw) : <library> ] ;
        }
        return [ $(result).add [ property-set.create $(raw) ] ] ;

which seems to do what I want but is probably not the right solution for all. I suppose it would be better to remove <library> for exe and shared link targets but I did not know how to do that. Maybe someone is willing to educate me?

Thanks,

Chris

-----Original Message-----
From: boost-build-bounces_at_[hidden] [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Matthew Chambers
Sent: Wednesday, November 23, 2011 4:22 PM
To: boost-build_at_[hidden]
Subject: Re: [Boost-build] EXE linking with DLLs

On 11/23/2011 8:20 AM, Nogradi, Chris wrote:
> Hello,
>
> I am trying to link an EXE against some DLLs (.libs) and when I do so, the exe rules is also trying
> to link against the static libs that the dlls depend on. Here is what I am doing:
>
> lib A : file1.c : <link>static ;
> lib B : file2.c A : <link>static ;
> lib dll : file3.c B : <link>shared ;
>
> exe test : main.c dll ;
>
> when test links, it includes dll.lib (this is good) and A.lib (which is not what I expected??) but
> not B.lib (which is what I expected). What am I doing wrong? I tried to use <library> without
> success. What is the proper way of linking against a dll without inheriting its dependant libs?
>
> I am using the msvc toolset and Boost.Build 2011.04-svn

Try:
lib A : file1.c ;
lib B : file2.c : <library>A/<link>static ;
lib dll : file3.c : <library>B/<link>static ;

exe test : main.c ; <library>dll/<link>shared

-Matt
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of this e-mail or any attachment is prohibited. If you have received this e-mail in error, please contact the sender and delete all copies.

Thank you for your cooperation.


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk