Thread overview
linux api functions
Sep 07, 2007
llee
Sep 07, 2007
Anders Bergh
Sep 07, 2007
Regan Heath
September 07, 2007
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?
September 07, 2007
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.
September 07, 2007
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