does the glibc come up with "POSIX share memory"?

does the glibc come up with "POSIX share memory"?

Post by jo » Sun, 02 Sep 2001 23:27:46



i type >gcc gc.c -D_GNU_SOURCE -lpthread -g -Wall
then i got ld errors like this >...undefined reference to
`shm_open',....undefined reference to `shm_unlink'
but they could be found in mman.h
why i couldn't use them?
(i using red hat 7.1)

thanks

best regard

joe

 
 
 

does the glibc come up with "POSIX share memory"?

Post by Karl Heye » Mon, 03 Sep 2001 01:50:12




> i type >gcc gc.c -D_GNU_SOURCE -lpthread -g -Wall then i got ld errors like
> this >...undefined reference to `shm_open',....undefined reference to
> `shm_unlink' but they could be found in mman.h
> why i couldn't use them?
> (i using red hat 7.1)

add -lrt

karl.

 
 
 

does the glibc come up with "POSIX share memory"?

Post by Jocelyn Maye » Sat, 08 Sep 2001 15:59:44



> i type >gcc gc.c -D_GNU_SOURCE -lpthread -g -Wall then i got ld errors
> like this >...undefined reference to `shm_open',....undefined reference
> to `shm_unlink' but they could be found in mman.h why i couldn't use
> them?
> (i using red hat 7.1)

> thanks

> best regard

> joe

The shared memory is part of the kernel.
Check that it has been compiled inside the kernel.
Then check that you have ipc part of the glibc.
You should find (and use !)
/usr/include/sys/ipc.h
/usr/include/sys/shm.h

Then link with the glibc....
Nothing more to do !!!

Good luck.

Jocelyn.