www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - linux api functions

reply llee <llee goucher.edu> writes:
I'm trying to call shmget(), and getpagesize(). I've imported
std.c.linux.linux, but the compiler doesn't recognize either function. can
anyone tell me what I need to do to call these functions?
Sep 07 2007
parent reply "Anders Bergh" <anders1 gmail.com> writes:
On 9/7/07, llee <llee goucher.edu> wrote:
 I'm trying to call shmget(), and getpagesize(). I've imported
std.c.linux.linux, but the compiler doesn't recognize either function. can
anyone tell me what I need to do to call these functions?
extern (C) int shmget(int /*key_t*/ key, size_t size, int shmflg); extern (C) int getpagesize(); I'm not sure what key_t should be in D, but I think it's int.
Sep 07 2007
parent Regan Heath <regan netmail.co.nz> writes:
Anders Bergh wrote:
 On 9/7/07, llee <llee goucher.edu> wrote:
 I'm trying to call shmget(), and getpagesize(). I've imported
std.c.linux.linux, but the compiler doesn't recognize either function. can
anyone tell me what I need to do to call these functions?
extern (C) int shmget(int /*key_t*/ key, size_t size, int shmflg); extern (C) int getpagesize(); I'm not sure what key_t should be in D, but I think it's int.
To find out for certain look for the definition of key_t in the C headers in /usr/include (or similar). Of course it is possible another OS defines it differently, so best thing to do is define it in your D source using a alias, eg. version(<yourOS>) { alias int key_t; } extern (C) int shmget(key_t key, size_t size, int shmflg); extern (C) int getpagesize(); Regan
Sep 07 2007