On Friday, 14 April 2017 at 11:32:57 UTC, DRex wrote:
I have project which involves both C and D code. For reasons
that are much too long to explain, I have to use GCC to compile
the C code into object files (GDC to compile the D code into
object files) and then ld to link all the object files
together. Now (unless I am missing something) ld cant link D
object files (a whole bunch of errors about undefined
references to a million different things) which I can only
assume is attributed to ld not knowing about the D libraries
and runtime. GDC can link D object files just fine, but again
for reasons too long to explain, I cannot use GDC to link the
object files together.
I need to take a handful of specific C files and a handful of
Specific D files and link them together (and redirect it into
another .o object file using the -r switch of ld) but again, ld
can't deal with D object files. I have tried using the
-Xlinker as well as -Wl switches from GDC to pass the -r switch
to the linker, but GDC just spews out "/usr/bin/ld: cannot find
-lgcc_s" and fails.
Sorry if I am making no sense, if I am not being clear, let me
know and I will try to re-explain, hoping someone can help me.
Cheers.
It is most likely the druntime libraries the linker is
complaining about, ld most certainly can deal with D object
files. You could try passing them to the linker, but I'm not
familiar with the -r option and how that would interact.
One of the verbose flags of gdc will probably allow you to see
the linker invocation (or strace or the like) and you could
replicate that.