Linking a C program with D library
Joe
jma at freedomcircle.com
Tue Aug 14 23:05:26 UTC 2018
I'm attempting a piecemeal conversion of some C programs. I've
converted a few that depend on C modules that are in a library
and now I'm sort of in the middle of converting those C modules.
One of them has an array of strings, i.e., array of char*, which
most easily translated to D's string[]. However, the array is
used by a function that expects a const char*, so I had to use
toStringz to pass those values.
Now there are some C programs that haven't been converted yet,
but they depend on the function above. When linking those
programs, the linker complains about an undefined reference to
the mangled name of std.string.toStringz.
What is the most appropriate way around this? Is there a way to
declare an array of const char* and initialize it to literal
strings? Or can the mangled name (and Phobos library) somehow be
made visible to the linker?
More information about the Digitalmars-d-learn
mailing list