Am 17.10.2011 12:21, schrieb Sean Kelly:
On Oct 16, 2011, at 7:02 PM, Walter Bright wrote:

The CAPI Manifesto
------------------

CAPI is a collection of C header files to publicly available C libraries
and their translations to D. The idea is that if, in C, to interface to a 
library
one would write:

   #include "foo.h"

then the corresponding D code would look like:

   import foo;

If the C header file has a name that is a D keyword, an underscore will be appended to 
the D module name.  If a C type name matches a C function name (stat), the type name will 
have a "_t" appended.

There's also the occasional issue of something that doesn't translate into D.  As one 
slightly weird example, some of the the Posix routines in OSX have alternates with odd 
suffixes like "$2003" that are the versions which should be called on newer 
versions of the OS.  I'm still not sure of the best way to handle this, since D doesn't 
have macros.


What about function-like macros, e.g. the Linux/POSIX cmsg stuff (CMSG_FIRSTHDR(), CMSG_NXTHDR(), CMSG_LEN() etc) needed to use functions like recvmsg() and sendmsg()?

Will there be a direct D translation of the functionality or will they be omitted completely?

Cheers,
- Daniel

Reply via email to