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

2012-10-05 Thread Jacob Carlborg
On 2012-10-04 21:30, timotheecour wrote: 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

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

2012-10-04 Thread Jacob Carlborg
On 2012-10-03 23:51, timotheecour wrote: In my case I can't: I don't have control over the main function (it could be written in C for example). If you're developing a library or similar you could have a requirement that the user need to call Library.initialize() before use. But of course,

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

2012-10-04 Thread timotheecour
If you're developing a library or similar you could have a requirement that the user need to call Library.initialize() before use. But of course, that's something anyone would like to avoid. I'm fine with that (and already doing this, to call Runtime.initialize), but that doesn't solve the

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

2012-10-04 Thread Jacob Carlborg
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. -- /Jacob Carlborg

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

2012-10-04 Thread timotheecour
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

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

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 02:55, timotheecour wrote: How do I call std_stdio_static_this() in std.stdio from a dynamically loaded shared library (osx) ? I need to do this in my scenario: 1) main program is launched 2) dynamic library is created 3) dynamic library is loaded and a function from it is called

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

2012-10-03 Thread timotheecour
Thanks for the links. Ya, I did see those threads and I understand there are limitations with dynamic load shared libraries, however, your answer is not very helpful. We shouldn't have to wait until they get 100% support to start using them (who knows when that happens); some applications just

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

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 08:56, timotheecour wrote: Thanks for the links. Ya, I did see those threads and I understand there are limitations with dynamic load shared libraries, however, your answer is not very helpful. We shouldn't have to wait until they get 100% support to start using them (who knows

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

2012-10-03 Thread timotheecour
Module constructors if one of the things that don't work properly. I don't know exactly how this works in std.stdio I would need to study the code. If I recall correctly std.stdio uses some kind of hack to avoid circular dependencies that can otherwise occur if two modules, both having module

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

2012-10-03 Thread Jacob Carlborg
On 2012-10-03 20:23, timotheecour wrote: Yes, that hack consists in : 1) defining extern(C) void std_stdio_static_this() instead of static this() 2) defining an auxiliary module std.stdiobase who will call it at module construction: module std.stdiobase; extern(C) void std_stdio_static_this();

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

2012-10-03 Thread timotheecour
What happens if you just call std_stdio_static_this the first you do in your main function? In my case I can't: I don't have control over the main function (it could be written in C for example). @property File stdin () { if (!_stdin.p) _stdin.p = stdinImpl; return _stdin;

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

2012-10-02 Thread timotheecour
How do I call std_stdio_static_this() in std.stdio from a dynamically loaded shared library (osx) ? I need to do this in my scenario: 1) main program is launched 2) dynamic library is created 3) dynamic library is loaded and a function from it is called 4) everything works fine until a