On Mon, 28 Feb 2011 08:00:28 -0500, Tarun Ramakrishna <lenk...@gmail.com>
wrote:

Hi Steven,

Yes, I have now understood that.

Is there a guidelines/best practices page somewhere that describes how
should a good library be coded for acceptance into the standard
library:  patterns and conventions, etc ? I am very new to D, but from
the mails I have read on this list so far, I have learnt that all the
devs here prefer that a library API should preferably take power of D
ranges, slices and generics. But what about other things ?

There is an issue with Windows system calls that is difficult to solve. D uses the DMC runtime, not the MSVC runtime. This means when you call C library functions (e.g. printf, fopen), it uses DMC's C library. The library has very poor support for converting to/from OS handles from things like FILE *.

This wouldn't be such a problem, except Phobos' I/O API is based on FILE *. This means any system calls you make (such as CreateNamedPipe) which return a HANDLE will be near impossible to wrap into a FILE *. In writing std.process, I had to write my own converters between FILE * and HANDLE, and when that code is available, you should be able to use it (expect to have it done by the next release of dmd).

But for now, I would concentrate on getting it to work for your code. One thing to keep in mind is that any library to be accepted into Phobos *should* be cross-platform if possible. I would think named pipes should be able to be a cross-platform library.

-Steve

Reply via email to