rtf_create_handler again

Jose Antonio Sanchez getaceres at yahoo.es
Mon Oct 11 18:27:14 CEST 2004

 --- Paolo Mantegazza <mantegazza at aero.polimi.it>
> Jose Antonio Sanchez wrote:
> > Sorry to insist, but I don't know what to do. I
> don't
> > know if I'm not getting response because nobody
> knows
> > how to solve it or because it's so easy to solve
> that
> > it's a waste of time to answer a newbie this
> > questions, but I can't do anything to solve it.
> > I'm getting an unresolved symbol on compile time
> > everytime I call rtf_create_handler on rtai 3.1
> I've
> > compiled it with the three inline modes, and it's
> the
> > same on everyone of them. I've looked rtai_fifos.h
> and
> > rtai_fifos.c and that function it's there. Maybe
> I'm
> > passing the handler the wrong way? What is the
> correct
> > way to do that? What is the right prototype for a
> > handler? Could it be that I'm using it with lxrt
> > instead of a module?
> > I'm lost. I don't know what's the problem. I don't
> > know if it's a bug of RTAI or not. Please, if
> somebody
> > knows anything, if someone has used it anytime,
> could
> > you please tell me how did you do it? how your
> > makefile was? what handler prototype did you use?
> > Thanks.
> > 
> A further comment.
> I suspect that your problem might be due to the way
> you compile modules 
> with Linux 2.6.7. If that is the case you should
> study a bit one of the 
> making way for the examples found in
> showroom/v3.x/kern.
> I've just compiled an old examples found in the
> 24.1.x series and it has 
> no problem with the fifo handler.
> Paolo.

Here it goes:
/* function definitions */
#define PERIOD 10000000
#define FIFO_ENTRADA 1

void *get_data(void *data);
int *handler(unsigned int fifo, int rw);
/* main task creation */
int main (int argc, char **argv) {
   mlockall(MCL_CURRENT | MCL_FUTURE);
   main_t =
/* Create receive fifo */
   tam_o = sizeof(order);
   if ((err=rtf_create(1,tam_o)) != 0) {
      printf("Hubo un error creando fifo, err =
      if (err == ENODEV) {
      printf("No such device\n");
      else {
         if (err == ENOMEM) {
         printf("Could not allocate FIFO memory\n");
/* Handler creation (in main) */
/* Handler function (out of main)*/
int *handler(unsigned int fifo, int rw) {
   order msg;
   int *res;   
   if (rtf_get(1,&msg,sizeof(msg)) == sizeof(msg)) {
      A = msg.A;
      w = msg.w;
      B = msg.B;
      return 0;
   else {
      printf("Error desconocido\n");
      return -1;
   return res;

As I said, I'm using lxrt, so i've not compiled it as
a module. Maybe it's a problem of mine and I can't use
rtf_create_handler in a lxrt task.

This is the makefile I'm using:

prefix := $(shell rtai-config --prefix)

ifeq ($(prefix),)
$(error Please add <rtai-install>/bin to your PATH

CC = $(shell rtai-config --cc)
LXRT_CFLAGS = $(shell rtai-config --lxrt-cflags)
LXRT_LDFLAGS = $(shell rtai-config --lxrt-ldflags)

all: test

test: test.c
	$(CC) $(LXRT_CFLAGS) -o $@ $< $(LXRT_LDFLAGS) -lm 

	rm -f *.o test

.PHONY: clean

This is the ouput when trying to compile my program:

gcc -I. -I/usr/realtime-noin/include -g
-I/usr/src/kernel-source-2.6.7/include -Wall
-Wstrict-prototypes -pipe -o test test.c
-L/usr/realtime-noin/lib -llxrt -lpthread -lm
test.c: En la función `main':
test.c:126: aviso: implicit declaration of function
test.c: En la función `handler':
test.c:221: aviso: return se crea un puntero desde un
entero sin una conversión
/tmp/ccQT1q4d.o(.text+0x271): En la función `main':
/home/jose/curro/poco a poco/threads/test.c:126:
undefined reference to `rtf_create_handler'
collect2: ld devolvió el estado de salida 1
make: *** [test] Error 1

The strange thing it's that I'm using rtf_get and
rtf_create and none of them gives me this error, only

Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad

More information about the Rtai mailing list