Re: redefine extern(C) function in a shared library

2012-10-03 Thread Jacob Carlborg
On 2012-10-04 01:35, timotheecour wrote: Is there a way to redefine a extern(C) function in a dynamic load library? (platform is OSX if that matters). In a normal D program, I can usually redefine a dynamic load library as follows: eg, for _d_assertm: extern(C) void _d_assertm(ModuleInfo* m, uin

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 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,

Question about memoize

2012-10-03 Thread Richie
I've pasted a code sample here with a comment of what should be printed out: http://dpaste.dzfl.pl/02cfc280 memoize is taken straight from std.functional, I just added a writeln so I could see more about what was going on. slowFuncString should only be calculated twice with the input given: O

Re: Metaprogramming: check for ref

2012-10-03 Thread mist
On Sunday, 30 September 2012 at 21:34:36 UTC, Andrej Mitrovic wrote: On 9/30/12, jerro wrote: I think this should work: template returnsRef(alias f) { enum bool returnsRef = is(typeof( { ParameterTypeTuple!f param; auto ptr = &f(param); })); } Yep. We should

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 _stdi

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(); s

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: Question about anonymous delegates.

2012-10-03 Thread Timon Gehr
On 10/03/2012 03:53 PM, Sharp wrote: I found something what I don't understand. Here is a simplifed code with comments: http://dpaste.dzfl.pl/a914d11a I creating anonymous delegates, whose function is to modify their parameter. Their parameters are different class references. I pass these class

Question about anonymous delegates.

2012-10-03 Thread Sharp
I found something what I don't understand. Here is a simplifed code with comments: http://dpaste.dzfl.pl/a914d11a I creating anonymous delegates, whose function is to modify their parameter. Their parameters are different class references. I pass these class references to anonymous delegates, b

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 when

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