Dynamically Loading a D DLL From a D Program

Guillaume Piolat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 15 02:38:39 PST 2016


On Wednesday, 14 December 2016 at 21:38:27 UTC, Benjiro wrote:
> It also seems that the core runtime is incomplete with basic 
> loading but no handling of dlsym, so your still forced to use 
> the basic c conversion casting.
>
>> int function() fn = cast(int function())dlsym(lib, 
>> libFunction);
>> fn();

You can use the derelict-util library to load a dynlib portably.

https://github.com/DerelictOrg/DerelictUtil/blob/2de2a9b63f8cdfbd8270afa8a4dc28f4ffaa868c/source/derelict/util/sharedlib.d#L110


More information about the Digitalmars-d-learn mailing list