Using D within a rust codebase
Jacob Carlborg
doob at me.com
Tue Jul 28 19:07:49 UTC 2020
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
More information about the Digitalmars-d-learn
mailing list