On Thursday, 8 August 2019 at 16:04:33 UTC, a11e99z wrote:
On Thursday, 8 August 2019 at 14:55:37 UTC, Andrey Zherikov
wrote:
I have the following code:
// main.d
int main()
{
import std.stdio;
writeln("hello");
return 0;
}
But if I create library from lib.d first and then link it
On Thursday, 8 August 2019 at 14:55:37 UTC, Andrey Zherikov wrote:
But if I create library from lib.d first and then link it with
main.d then ctor/dtor are not called:
For this to work as expected, the `lib.obj` object file needs to
be linked into the final executable. As main.d doesn't need
On Thursday, 8 August 2019 at 14:55:37 UTC, Andrey Zherikov wrote:
I have the following code:
// main.d
int main()
{
import std.stdio;
writeln("hello");
return 0;
}
But if I create library from lib.d first and then link it with
main.d then ctor/dtor are not called:
$ dmd.exe -lib
On Thursday, 8 August 2019 at 14:55:37 UTC, Andrey Zherikov wrote:
I have the following code:
// lib1/lib.d
module lib;
import std.stdio;
static this()
{
writeln("+" ~ __FILE__);
}
static ~this()
{
writeln("-" ~ __FILE__);
}
// main.d
int main()
{
import std.stdio;
I have the following code:
// lib1/lib.d
module lib;
import std.stdio;
static this()
{
writeln("+" ~ __FILE__);
}
static ~this()
{
writeln("-" ~ __FILE__);
}
// main.d
int main()
{
import std.stdio;
writeln("hello");
return 0;
}
So if I compile lib.d and main.d together