how to call std_stdio_static_this from a dynamically loaded shared library (osx)

timotheecour thelastmammoth at gmail.com
Thu Oct 4 12:30:19 PDT 2012


On Thursday, 4 October 2012 at 19:20:54 UTC, Jacob Carlborg wrote:
> On 2012-10-04 20:13, timotheecour wrote:
>
>> I'm fine with that (and already doing this, to call 
>> Runtime.initialize),
>> but that doesn't solve the issue of this thread.

> No, not if you need to redefine functions.

Even if I don't need to redefine:

As I was explaining in the first post, my original problem was 
that calling the existing (non-templated, non-modified) extern(C) 
std_stdio_static_this() seems to have no effect: a call to 
writeln(0) will cause a runtime crash in the shared lib.

Even after a call to Runtime.initialize. So far, only adding a 
templated version std_stdio_static_this2()() and calling it 
allows writeln(0) to work.

I wish somebody had an explanation why std_stdio_static_this() 
doesn't work but std_stdio_static_this2()() works.





More information about the Digitalmars-d-learn mailing list