<div class="gmail_quote">On 13 April 2012 14:07, Timon Gehr <span dir="ltr"><<a href="mailto:timon.gehr@gmx.ch">timon.gehr@gmx.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 04/13/2012 12:47 PM, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
No comment...<br>
<br>
I'm also finding that I really need an assert hook. The default assert<br>
implementation is not useful to me, and just crashes my programs<br>
(exceptions when interacting with C is problematic).<br>
I'd like to route runtime asserts through my own system. A simple<br>
backend hook would sort me out here too..<br>
<br>
Does anyone know any existing way to do the stuff I'm talking about here?<br>
If not, what do people think about the possibility of putting hook<br>
register functions into druntime?<br>
<br>
On 9 April 2012 03:59, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a><br></div><div><div class="h5">
<mailto:<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>>> wrote:<br>
<br>
    So one thing that almost every major middleware provides, is an<br>
    interface to hook your own allocation and filesystem callbacks under<br>
    the hood, to allow integration with your potentially complex technology.<br>
<br>
    In my industry, memory and filesystem hooks are non-negotiable. We<br>
    can't use any middleware that does not provide them.<br>
    Traditionally, we have a problem with the C library, and many core C<br>
    libs which depend heavily on the CRT. Almost all games engines have<br>
    to wastefully rewrite large portions of the CRT, just to implement<br>
    the appropriate memory and filesystem interface, and some super<br>
    handy common libs are lost to us due to lack of this foresight.<br>
<br>
    So this in mind, many of the goodies in phobos are currently<br>
    unusable to us (although fortunately source is available).<br>
    Has it ever been considered to allow hooks into the backends of<br>
    those systems which could be registered at runtime?<br>
    It would be simple to provide an API where you could register the<br>
    filesystem primitives, which all standard libraries would then<br>
    magically route through (huzzah!).<br>
    A primitive malloc/free hook would be nice to have too, that way we<br>
    can direct memory to the appropriate locations, and keep mem stats<br>
    along with the the rest of the system.<br>
    It's not uncommon to malloc the entire heap on boot, and implement<br>
    our own heap management through our own API's. Obviously system<br>
    functions would fail to allocate memory in this environment...<br>
<br>
    Having these hooks in phobos would also lift this burden off of<br>
    library developers (usually only added on request with a few months<br>
    turn around time, which is no good for project scheduling), and it<br>
    would never prevent us access to those libraries where the<br>
    developers never considered our use case.<br>
<br>
<br>
</div></div></blockquote>
<br>
<a href="http://dlang.org/phobos/core_exception.html" target="_blank">http://dlang.org/phobos/core_<u></u>exception.html</a><br>
deprecated void setAssertHandler(<u></u>errorHandlerType h);<br>
<br>
Why is it deprecated?<br></blockquote><div><br></div><div>Awesome, I missed that. Although it sucks it's deprecated, what's the intended alternative?</div><div><br></div><div>Now if I could only have more of those for malloc/free, and fopen/close/read/write/seek etc.</div>
</div>