On 1/17/20 7:53 PM, Adam D. Ruppe wrote:
Did you already try rt_init? That should trigger it....

I was under the impression that the extern (C) function rt_init() would magically be exposed from the library but 'nm' showed no such symbol. So, I ended up exposing a my_init() function, which called rt_init() internally.

I've realized that rt_init() is sneaky: it returns 1 for success. WAT!? :p Then I discovered the more readable Runtime.initialize(), which is also sneaky by returning 'true' for success. WAT!? WAT!? :p

This worked:

import core.runtime;

extern (C)
int my_init() {
  return tried({
    return Runtime.initialize ? 0 : 1;
  });
}

my_deinit() is similar...

Ali

P.S.'tried' is a function template that I wrote, which catches all throwables, logs the issue, and returns 1 as an error code.

Reply via email to