On 6/16/22 09:07, Sergeant wrote:

> May I ask one more question: why a code like this would work in
> D-application but not in D-DLL?

D programs generated by D compilers automatically initialize the D runtime. You can do the same with rt_init:

pragma (crt_constructor)
extern(C) int initialize() { // Can have any name
  return rt_init();
}

And to deinitialize;

pragma (crt_destructor)
extern(C) int terminate() { // Can have any name
  return rt_term();
}

Although, I haven't tested it with a DLL but with .so libraries on Linux... :/

This answer may be relevant:

  https://forum.dlang.org/post/t8diks$2l79$1...@digitalmars.com

Ali

Reply via email to