Using dlopen/dlsym

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 26 17:34:48 PST 2016


On 12/26/2016 07:35 PM, Nicholas Wilson wrote:
> On Tuesday, 27 December 2016 at 00:05:39 UTC, 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);
>
> Does auto p = dlsym(hndl, fun.mangleof.ptr);
>
> work any better?

No, same result. -- Andrei


More information about the Digitalmars-d mailing list