Cross Compiler
Jeroen Bollen
jbinero at gmail.com
Tue Mar 4 08:21:58 PST 2014
On Tuesday, 4 March 2014 at 01:22:15 UTC, Adam D. Ruppe wrote:
> On Monday, 3 March 2014 at 19:03:20 UTC, Jeroen Bollen wrote:
>> Just realized that's probably the missing runtime. Why does it
>> need a runtime though? It's just returning.
>
> There's some hidden references to the runtime outputted,
> especially when you write a D main, which adds references to
> d_run_main and other such stuff.
>
> If you make it an extern(C) main instead of a regular D main,
> it gets rid of some of that, but it will still complain about
> the d_dso_registry thing (at least on Linux).
>
> You can add a dummy "extern(C) void _d_dso_registry() {}" to it
> to hack past that too, but you probably shouldn't - going
> without the runtime is a fair amount of work for little
> practical benefit, though it can be pretty educational.
>
> The definition of this function in druntime is
> src/rt/sections_linux.d
>
> From that file:
>
> /* For each shared library and executable, the compiler
> generates code that
> * sets up CompilerDSOData and calls _d_dso_registry().
> * A pointer to that code is inserted into both the .ctors and
> .dtors
> * segment so it gets called by the loader on startup and
> shutdown.
> */
> extern(C) void _d_dso_registry(CompilerDSOData* data)
What does the runtime actually do?
More information about the Digitalmars-d
mailing list