On 2016-12-27 01:05, Andrei Alexandrescu wrote:
Consider this code:

===========
import core.sys.posix.dlfcn;
extern(C) void fun() {}
void main()
{
    fun();
    void *hndl = dlopen(null, RTLD_LAZY);
    if (!hndl) assert(0);
    auto p = dlsym(hndl, "fun".ptr);
    if (!p)
    {
        import core.stdc.stdio;
        printf("%s\n", dlerror());
    }
}
===========

It works (i.e. outputs nothing) on http://dpaste.dzfl.pl and on
Vladimir's machine.

On my Mint and Ubuntu machines it outputs:

./test: undefined symbol: fun

I'm building with no flags using dmd. What could be the problem here?

I tried on Mint 18 and Ubuntu 16.10 with DMD 2.072.2-b1, it worked for me.

Which versions of Mint, Ubuntu, dmd, gcc, ldd etc. are you using?

--
/Jacob Carlborg

Reply via email to