[ECOS] Interprocess communication

Alfredo Carrillo alcarrillo@tec.com.mx
Thu Feb 28 14:16:00 GMT 2002

I am developing a pager simulation under the Linux synthetic target. In 
order to simulate the pager's face I did a GTK+ program.

To comunicate the GTK+ process whith eCos program, I am trying to 
implement a shared memory segment using the UNIX IPC system calls. Below 
is part of the eCos code I'm using to create the new shared memory segment.

#include <cyg/kernel/kapi.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <sys/types.h>

cyg_thread thread_s[1];
char stack[1][4096];

cyg_handle_t simple_threadA;
void simple_program(cyg_addrword_t data);

void cyg_user_start(void)
 printf("Entering cyg_user_start()\n");

 cyg_thread_create(4, simple_program, (cyg_addrword_t) 0,
           "Thread A", (void *) stack[0], 4096,
           &simple_threadA, &thread_s[0]);


/* This is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
 int message = (int) data;

 key_t key = 15;
 int shmid_1;

 printf("Beginning execution; thread %d\n", message);

 if ((shmid_1 = shmget(key, 1000, 0644|IPC_CREAT)) == -1) {
   perror("shmget shmid_1");

 printf("Memory identifier is %d\n", shmid_1);

But the compiler sends this output:
*shmCr.c:39: undefined reference to `shmget'*

Does anybody know what is wrong?, or what can I do to communicate both 

Thanks a lot in advance.

Alfredo Carrillo

Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list