D and SCons [ was Re: bigint <-> python long ]
Johannes Pfau
nospam at example.com
Mon Sep 10 05:48:30 PDT 2012
Am Sun, 09 Sep 2012 12:55:19 -0700
schrieb Brad Roberts <braddr at puremagic.com>:
> On 9/9/2012 1:15 AM, Johannes Pfau wrote:
> > Am Sat, 08 Sep 2012 16:25:49 +0100
> > schrieb Russel Winder <russel at winder.org.uk>:
> >
> >> On Sat, 2012-09-08 at 07:20 -0700, Ellery Newcomer wrote:
> >> […]
> >>> Okay, here:
> >>> https://bitbucket.org/ariovistus/deimos-elfutils/overview
> >>>
> >>> I have some code with a working makefile and a nonworking
> >>> SConstruct file.
> >>>
> >>> I believe the issue is the header files have pragma(lib, X) in
> >>> them, and a single call to dmd links the appropriate lib in, but
> >>> scons' link step loses that information.
> >>>
> >>> Do you have any intention of supporting pragma(lib) in scons?
> >>
> >> If that is valid Dv2 and SCons doesn't deal with it then the SCons
> >> D tools are broken and need fixing.
> >>
> >> Is there a tiny project replicating this that I can turn into a
> >> unit/system test. The red so caused will necessitate action :-)
> >>
> >
> > Please note that pragma(lib) is an evil feature. For example it will
> > never work in gdc.
> >
>
> It's not impossible and never is rather defeatist. Using the
> frontend as is and grabing the json output, part of which includes
> the pragmas, would be easy. Then invoking gdc with the appropriate
> options to get the library linked in. rdmd is a good example of this
> sort of process.
>
>
Is there a special flag to enable pragmas for the json output? It does
not work with gdc right now, but it should be possible to make it work.
Sorry, I should have said 'It'll _probably_ never be supported in gdc'.
There are some possible solutions but:
* It must be good enough to get approved when gdc is merged into gcc.
(remember it must be portable and gpl and you can't use
stdout/stdin...)
* Someone would have to implement the solution. I guess Iain had his
reasons not to implement it so somebody else would have to do that.
Of course you can always try to make it work with external build
tools. But a solution _in_ gdc seems not very likely.
I don't want to badmouth the pragma(lib) feature, in some cases it's
nice to have (mainly building simple script-like programs with few
source files). But for bigger projects, pragma(lib) makes things
difficult (incremental compilation; build tools usually check if a
library is available before trying to link against it so they can put
out a nice warning. pragma(lib) in dmd subverts this feature; can't
specify linker path with pragma lib, can't specify static vs dynamic
linking, ...).
The C/C++ architecture splits compilation and linking. Trying to
conflate those concepts as pragma(lib) does, might even be a good
idea(other languages have done it for some time now). But as we have to
deal with tools that were designed for C/C++ (linkers, gcc) we'll
always hit some issues with pragma(lib).
More information about the Digitalmars-d-learn
mailing list