On 2020-07-27 13:43, Ali Çehreli wrote:

They should be taken care of when the program is linked with a D compiler.

Just linking with a D compiler is not sufficient. There needs to be a D main function for the runtime to automatically be initialized. If you make the D code a bit more complicated, for example:

static this()
{
    import std.stdio: writeln;
    writeln("static this");
}

Then that won't be printed without a D main function or manually initializing the runtime.

The initial question was about linking D code into an already existing Rust code base. I don't think the first thing to try is to replace the Rust main function with a D main function.

--
/Jacob Carlborg

Reply via email to