[Scons-dev] SCons, D, and shared objects

Russel Winder russel at winder.org.uk
Wed Jun 21 06:39:57 EDT 2017


In the beginning, DMD always created statically linked executables and
static libraries. Go has gone that route as well. However to interwork
with C and C++, D has had to embrace shared objects. I had begun to
hack something together in the dmd, ldc, and gdc tools sometime back.
Now for SCons 3.0 I'd like to have it working properly. On Linux and
UNIX with dmd and ldc anyway. OSX and macOS remain a problem for dmd,
and gdc hasn't really caught up yet.

There is a problem.

The C and C++ tools assume that on Linux for shared libraries creation,
the objects should have the extension .os instead of .o. The D
compilers do not accept this, they demand .o extension. So what is the
problem? SHOBJSUFFIX. This is a global value shared by all tools. The
default is .o. One of the C or C++ compiler tools sets it to .os. This
is not a problem for builds that explicitly declare environments and
limit the tools to D tools – which is what I do for all my builds which
is why the problem has only recent;y come to light. If you use not
envronment or a new environment with no tools specification you get all
the tools and so the extension is forced to .os and all D compilations
for shared libraries fail.

So my problem is how to incorporate a SHDOBJSUFFIX so as to separate D
builds to work around this problem. What I need to know is where the
TARGET symbol is construction so I can create a variant of the default
for the D tooling. All the compilation commands rely on TARGET and
SOURCE and TARGET appears always to use SHOBJSUFFIX for shared object
building.

Sorry about the long explanation. I am hoping that I have just missed
something very simple, and that someone can tell me what this is – or
at least point me int he right direction.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20170621/e7b1b56a/attachment.pgp>


More information about the Scons-dev mailing list