Standard third party imports

Adam D. Ruppe destructionator at gmail.com
Sat Nov 13 08:43:41 PST 2010


I'm wondering, would be be a good idea to add some .di files to the standard
distribution, or easily accessible next to it, for some common third party C
libraries?

For example, I used import sdl.SDL in another thread yesterday to quickly port
a C toy, but most people probably can't do that since they don't have the same
collection of interface files I have.

There's other times where I write an extern(C) {} block myself with the
prototypes I use (actually this is common for me) but that's a pain if the C
function needs a lot of #defines, structs, etc. A nice group of common imports
would be, well, nice.


I'm not talking about wrappers, just interfaces. So

import etc.c.sdl.SDL;

Then use it C style: SDL_namehere and manual freeing, etc. You can use that
directly, or if you want to, wrap it in D.


Do that for a handful of common libraries. SDL, curl, mysql, a few others. On
Windows, perhaps provide the .lib files for linking to the DLL as well so
people don't have to track that down. (This doesn't require the inclusion of
any code either. It's just a function list.)



What it will *not* include is the actual libraries themselves. Nothing needs
to actually be compiled into Phobos. It's just a convenient interface to some
common C functions, like we provide to the operating system. Being just
headers, the source is included by definition and no code of it whatsoever is
compiled into Phobos itself, so it wouldn't taint anything else. (indeed,
phobos2.lib shouldn't change /at all/ by the inclusion of these files in the
proposed etc branch).

We'd still have pure Boost/public domain binaries with the standard
distribution while making more libraries a wee bit more accessible.


What do you think?


More information about the Digitalmars-d mailing list