How do I use my c/c++ libraries in D?

Lutger lutger.blijdestijn at gmail.com
Tue Dec 19 05:15:12 PST 2006


Stan Hebben wrote:
> I have a lot of questions about using my c/c++ libraries in d.
> - How does the compiler 'map' the c libraries to d modules? (ex. if I write
> 'import std.c.stdio', where does the compiler look for this file)

The standard C library is included in the runtime, see 
dmd\src\phobos\std\c for declarations.

> - Does the D compiler use C header files, or header files which are converted
> to D?

Headers files which are converted to D. See 
http://www.digitalmars.com/d/htomodule.html for converting header files 
to D. There is also a tool which can do a lot automatically: 
http://www.digitalmars.com/d/htod.html

> I mainly want to use the Windows / DirectX API in D, as well as some other
> libraries.

Take a look at www.dsource.org if you have not done already, chance is 
that there is already a binding. The wiki4d may also have more links to 
bindings. A set of bindings for win32 is here: 
http://www.prowiki.org/wiki4d/wiki.cgi?WindowsAPI

I have seen some directx bindings somewhere, but don't remember where 
they are.

> I suppose this question has been asked many times, but I couldn't find it on
> the forums. (neither did I find my answer somewhere else on the web)


More information about the Digitalmars-d-learn mailing list