[D-runtime] core.sys.posix.dlfcn

Sean Kelly sean at invisibleduck.org
Fri May 11 14:42:58 PDT 2012


On May 11, 2012, at 12:24 PM, David Nadlinger wrote:

> On 11 May 2012, at 21:16, Alex Rønne Petersen wrote:
>> It seems that the declarations in the various version branches of
>> core.sys.posix.dlfcn are identical unless I'm seriously overlooking
>> something. Can we simplify this file?
> 
> I haven't looked at the file in question, but I think Sean generally prefers it this way, because it supposedly makes keeping our modules in sync with the respective platform headers easier.

dlfcn is a part of the XSI extensions to the Posix spec, meaning that it's not required to exist on a platform that claims Posix compliance.  When we add support for a new OS, I don't want people to think they can call dlopen() if it's not actually supported--I'd rather have them get a compile error and submit a ticket to have the declarations investigated/added.

Also, I don't want to have to rewrite portions of a module when adding support for a new platform.  The current approach does mean a lot of duplication in some cases, but it's the most foolproof approach I've come up with.

Finally, I do think it's easier to have the declarations for all OSes in one file instead of having core.sys.posix.dlfcn publicly import core.sys.darwin.dlfcn, core.sys.linux.dlfcn, etc.  It's easier to see at a glance what's portable across OSes I care about, which OSes haven't had declarations filled out somewhere, etc.


More information about the D-runtime mailing list