why do i need an extern(C): here?

Ali Çehreli acehreli at yahoo.com
Fri Oct 16 23:43:28 UTC 2020

On 10/16/20 4:12 PM, WhatMeWorry wrote:

 > Isn't dlopen() for Linux

More like dlopen() is for Posix, which means it should be available on 
Windows as well.

However, as I've discovered, a D shared library cannot be loaded with 
dlopen() because the main program and the shared library would do their 
own garbage collection (presumably with separate GC states) without 
being aware of each other and this won't work. Runtime.loadLibrary() 
knows to do the right thing and both sides are aware of each other.

 > and LoadLibrary() for Windows?

Yes, but I am talking about core.runtime.Runtime.loadLibrary, which 
should call appropriate functions depending on the operating system.

 > Or are you
 > running Windows

I run Windows with mild disgust :p only for work-related applications. 
Otherwise, it's all Linux.


More information about the Digitalmars-d-learn mailing list