D Windows support

Steven Schveighoffer schveiguy at yahoo.com
Wed Jun 16 12:29:16 PDT 2010


On Wed, 16 Jun 2010 13:03:09 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> I'm running into some issues while trying to make portable code for  
> Phobos.
>
> One of the issues is the open system call.  Apparently, it's defined in  
> core.sys.posix.fcntl.  However DMC supports it (via the io.h header), so  
> does anyone know where I can find it?  Do I have to add it?  Can I  
> safely import any posix files on Windows?
>
> I really have to say that depending on DMC and the standard C library in  
> general is rather annoying...

OK, I found some DMC support in here: std.c.stdio.  Should I put my stuff  
in there?

I plan to expose/implement the following functions:

open
close
_fdToHandle -> get the HANDLE that backs a file descriptor
_handleToFd -> create a file descriptor for a given handle.

I need this because DMC doesn't really allow unbuffered I/O through libc,  
and the ability to use HANDLEs from Win32 functions is extremely limited.

I'll put it in std.c.stdio for now, and if someone comes up with a better  
place, we can move it.

-Steve


More information about the Digitalmars-d-learn mailing list