Can I create static c callable library?
Jacob Carlborg
doob at me.com
Tue Sep 25 14:13:50 UTC 2018
On Tuesday, 25 September 2018 at 12:05:21 UTC, Jonathan M Davis
wrote:
> If you use -betterC, then it's trivial, because your D program
> is restricted to extern(C) functions and features which don't
> require druntime. It can also be done without -betterC (and
> thus with druntime), but it gets to be _way_ more of a pain,
> because it requires that you manually initialize druntime -
> either by forcing whatever is using your "C" library to call a
> specific function to initialize druntime before using any of
> its normal functions or by having every function in the library
> check whether druntime has been initialized yet and initialize
> it if it hasn't been before it does whatever it's supposed to
> do.
Shouldn't it be possible to use a C initialization function, i.e.
pragma(crt_constructor) to initialize druntime? Then it only
needs to be initialized once and it's not required to check if
it's initialized all the time.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list