www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there a wrapper for libuv?

reply "Tyler Jameson Little" <beatgammit gmail.com> writes:
I hope this is the right place to ask this.

libuv is the evented IO library that nodejs uses internally. It 
is basically glue for a bunch of other libraries (libev, c-ares, 
libeio and others).

https://github.com/joyent/libuv

Is there already working on a wrapper? I would very much like to 
use it, because it's cross-platform, but I couldn't find it 
anywhere (deimos has libev and libevent though).

I started a wrapper, but there were a couple of header files that 
I couldn't find:

sys/types.h
netinet/in.h

Do these already exist?
Mar 06 2012
parent reply James Miller <james aatch.net> writes:
On 7 March 2012 13:52, Tyler Jameson Little <beatgammit gmail.com> wrote:
 I hope this is the right place to ask this.

 libuv is the evented IO library that nodejs uses internally. It is basically
 glue for a bunch of other libraries (libev, c-ares, libeio and others).

 https://github.com/joyent/libuv

 Is there already working on a wrapper? I would very much like to use it,
 because it's cross-platform, but I couldn't find it anywhere (deimos has
 libev and libevent though).

 I started a wrapper, but there were a couple of header files that I couldn't
 find:

 sys/types.h
 netinet/in.h

 Do these already exist?
sys/types is part of the C runtime if I remember correctly, and netinet/in.h is part of the Unix networking interface. You shouldn't have to do anything with them, just write bindings for the api, with all the correct types. -- James Miller
Mar 06 2012
parent reply "Tyler Jameson Little" <beatgammit gmail.com> writes:
 You shouldn't have to do anything with them, just write 
 bindings for
 the api, with all the correct types.

 --
 James Miller
Thanks! I guess I got a little over-zealous in porting stuff over. I just need to create extern (C) bindings for the functions that will be used, right?
Mar 06 2012
parent James Miller <james aatch.net> writes:
On 7 March 2012 14:47, Tyler Jameson Little <beatgammit gmail.com> wrote:
 You shouldn't have to do anything with them, just write bindings for
 the api, with all the correct types.

 --
 James Miller
Thanks! I guess I got a little over-zealous in porting stuff over. I just need to create extern (C) bindings for the functions that will be used, right?
Pretty much, yeah. Remember that these declarations are only there to keep the compiler happy, and to provide some information to the linker when you link against the library, Ultimately you should be able to port any C code written for the library into D directly without significant changes (syntax changes etc), once the wrapper is done. Also, when you're done, submit the wrapper to Deimos. -- James Miller
Mar 06 2012