On Wednesday, 3 August 2016 at 13:44:46 UTC, llaine wrote:
void puts(string str) { writeln(str); }
A D string isn't the same as a C string, so your params won't work as-is, and writeln requires the D runtime to be initialized.
Does the ruby gem have a way to automatically call a particular setup and teardown function in the library? You could make init and and finalize functions that are called. Those run the Runtime.initialized and Runtime.finalize.
Looking at their docs, I don't see an automatic one, but you could do a ruby constructor/destructor in the wrapper that does it for the end user.
For the D string, either replace it with a C char* or try defining a struct on teh ruby side to match it... but C string is probably easiest.