Hi Ana,
If you have multiple files that make up a module, only one can define
the version, and that should be the one that has the
init_module/cleanup_module.
In the 'main' file with the init_module, I use:
#include <linux/module.h>
#include <linux/version.h>
In other files, that need to be linked with this, I use:
#define __NO_VERSION__
#include <linux/module.h>
#include <linux/version.h>
Regards, Stuart.
Vidarte Ana wrote:
>
> Dear Stuart,
>
> I continue trying to make my real time aplication, which is composed of
> different .c files.
>
> I have proved to bind the object files together usin ld -r as you said. But,
> I receive some error message. In fact, I have the following files:
> modulo_rt.c; fun.c; modelo.h. Modulo_rt.c uses some functions that are
> defined in fun.c. In modelo.h are the declarations of these function. So,
> modelo.h is the include file in modlo_rt.c.
>
> I have write the following makefile:
>
> all: modulo_rt.o
>
> include rtl.mk
>
> fun.o: fun.c
> $(CC) ${INCLUDE} ${CFLAGS} fun.c -o fun.o
>
> modulo_rt_tmp.o: modulo_rt.c modelo.h
> $(CC) ${INCLUDE} ${CFLAGS} -c modulo-rt.c -o modulo_rt_tmp.o
> modulo_rt.o : modulo_rt_tmp.o fun.o
> ld -r static -o modulo_rt.o modulo_rt_tmp.o fun.o -L/usr/lib -lm -lc
> clean:
> rm -f *.o
>
> When I type make, I received the following message:
>
> fun.c : multiple definition of __module_kernel_version. In this line there
> is the rtl_printf() funtion.
> modulo_rt_tmp.o(.modinfo+0x0) first defined here.
> make: [modulo_rt.o] Error 1.
>
> Can you help me?
>
> Ana.
>
> > -----Mensaje original-----
> > De: Stuart Hughes [SMTP:[EMAIL PROTECTED]]
> > Enviado el: miércoles 24 de noviembre de 1999 18:14
> > Para: Vidarte Ana
> > CC: Rtlinux (Correo electrónico); RealTimeLinux
> > Asunto: Re: [rtl] real time application
> >
> > Hi Ana,
> >
> > If I understand correctly, the problem is in how you build. The crux of
> > the problem is that you need to build the object files separately and
> > then bind the object files together using ld -r.
> >
> > I have not tested it, but a Makefile similar to the stuff below should
> > work (note you need tabs for the commands, the output module is called
> > module_rt):
> >
> > RTFLAGS = -D__RT__
> > INC = -I. -I/usr/src/rtl/include
> > KFLAGS = -D__KERNEL__ -DMODULE
> > CFLAGS = $(INC) -Wall -O2 -g $(RTFLAGS)
> > MOD_FILES = module_rt.o fun.o
> >
> > module_rt : $(MOD_FILES)
> > $(LD) -r -o $@ $^
> >
> > %.o : %.c
> > $(CC) -c $(CFLAGS) $(KFLAGS) -o $@ $<
> >
> >
> > Regards, Stuart
> >
> >
> >
> > Vidarte Ana wrote:
> > >
> > > Hello,
> > >
> > > I would like to make a real time application
> > [snip]
> > >
> > > The following functions Actualiza_modelo(), Salida_modelo,
> > > Inicializa_modelo, Finaliza_modelo() are in a different file: fun.c and
> > they
> > > are declared in the include file # include modelo.h.
> > >
> > > How would I compile and create the RTL programm?
> > >
> > > I have proved
> > > make -f rtl.mk modulo_rt.c fun.c modulo_rt.o but the module_rt.o does
> > not
> > > recogniza the functions written in fun.c file.
> > >
> > > Would I make a RT program with main() function with
> > > pthread_create();
> > > pthread_setperiod_np(); and so on
> > > functions?
> > >
> > > Could someone help me, please?
> > >
> > > Ana.
> > >
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/