linking druntime in when C calls D and C implements main()
Carl Sturtivant
sturtivant at gmail.com
Fri Jul 27 10:06:24 PDT 2012
If I separately compile dfunc.d containing an exern(C) function,
and cmain.c containing void main() that calls that function
(after calling rt_init() to initialize druntime) and then ask dmd
to link the resulting pair of objects into an executable, the
linker complains that various symbols (including _rt_init) are
not present, suggesting that (quite reasonably) dmd does not
place druntime inside an arbitrary d object file. How to I ask
dmd to link in druntime so as to get a working executable in this
situation exemplifying a C application calling a D library
function with C linkage?
More information about the Digitalmars-d
mailing list