On Sunday, 5 January 2014 at 20:47:44 UTC, FreeSlave wrote:
import core.runtime;

int main()
{
    Runtime.loadLibrary("does not care");
    Runtime.unloadLibrary(null);
    return 0;
}

When I try to compile this code with 'dmd main.d', I get errors

main.o: In function `_D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv': main.d:(.text._D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv+0x4d): undefined reference to `rt_loadLibrary' main.o: In function `_D4core7runtime7Runtime19__T13unloadLibraryZ13unloadLibraryFPvZb': main.d:(.text._D4core7runtime7Runtime19__T13unloadLibraryZ13unloadLibraryFPvZb+0x8): undefined reference to `rt_unloadLibrary'

But it's built without errors when I separate compile and link parts:
dmd -c main.d
gcc main.o -lphobos2 -o main

I checked libraries with nm utility and actually found no such symbols in static version of libphobos. But shared one has these symbols.

Well, I'm aware of that runtime loading requires shared version of phobos2 to avoid duplicating of D runtime. But why does dmd use static linking by default? Is shared version of phobos still experimental? Anyway we need some remarks in documentation about the lack of these functions in static version of phobos.

This seems like a weird change if intentional, since the function is publicly declared. I'd file a bug report.

Reply via email to