Linking with a non-default druntime
Basile B.
b2.temp at gmx.com
Sun Sep 30 19:53:02 UTC 2018
On Sunday, 30 September 2018 at 19:03:17 UTC, Per Nordlöw wrote:
> How can I link my dmd-compiled program with a specific version
> of the druntime?
druntime is within libphobos. So you must change this.
>
> I need this when experimenting with a new GC.
Did you try what i proposed earlier ? Until the handlers are
plugged there can be a fallback to the manual allocs.
For example you start with the manual implementation and add
handlers + fallback for every functions, like here for malloc
```
__gshared void* function(size_t, uint, const TypeInfo)
nothrow mallocHandler;
void* malloc(size_t size, uint bits, const TypeInfo ti)
nothrow
{
if (mallocHandler) // experimental stuff
{
return mallocHandler(size, bits, ti);
}
else // fallback until handler is assigned
{
void* p = cstdlib.malloc(size);
if (size && p is null)
onOutOfMemoryError();
return p;
}
}
```
this way you can very easily change-compile-test, without
recompiling the whole runtime and phobos each time.
More information about the Digitalmars-d-learn
mailing list