Can I create static c callable library?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Sep 28 16:09:47 UTC 2018


On Fri, Sep 28, 2018 at 02:08:25PM +0000, Atila Neves via Digitalmars-d-learn wrote:
> On Thursday, 27 September 2018 at 23:53:50 UTC, Steven Schveighoffer wrote:
[...]
> > Since C initialization functions have no order to them, it's
> > possible that some  initialization functions in the D runtime are
> > using uninitialized pieces of the C runtime
> 
> No, that can't happen. The C runtime is initialised no matter what you
> do (unless you write `_start` yourself), _then_ the global
> constructors are run. The code I wrote isn't standard C - it's just
> that gcc/clang/cl are all also C++ compilers so they chose to extend
> the already existing functionality to C.
[...]

Potentially some C libraries have not yet been initialized, though.  I
don't know if the druntime init depends on any of them -- it's doubtful,
but if it does, it may cause problems depending on which order library
ctors are called.


T

-- 
In a world without fences, who needs Windows and Gates? -- Christian Surchi


More information about the Digitalmars-d-learn mailing list