Problem with -lm and complex.h (kernel space)

Hello,

I want use the value read from a daq board, using
comedi driver, to calculate some equations, like DFT.
I'm writing a simple 2.6.7 kernel module that use
complex.h (cexp, cimag, creal, etc...). It compile
correct, see below:

--------------
make -C /usr/src/linux SUBDIRS=/home/pecenin/modulo
modules
make[1]: Entering directory `/usr/src/linux-2.6.7'
CC [M] /home/pecenin/modulo/mat.o
CC [M] /home/pecenin/modulo/modu.o
LD [M] /home/pecenin/modulo/modcalc.o
Building modules, stage 2.
MODPOST
CC /home/pecenin/modulo/modcalc.mod.o
LD [M] /home/pecenin/modulo/modcalc.ko
make[1]: Leaving directory `/usr/src/linux-2.6.7'
----------------

but when I load with 'insmod modcalc.ko' I get, from
'dmesg':

----------
modcalc: Unknown symbol __fixdfsi
modcalc: Unknown symbol cexp
----------

The makefile used:

-------------
EXTRA_CFLAGS := -I$(src) -I/usr/include
EXTRA_LDFLAGS := -L/usr/lib --start-group -lm
--end-group

obj-m := modcalc.o
modcalc-objs := mat.o modu.o

KDIR := /usr/src/linux
LDIR := $(PWD)

all:
make -C $(KDIR) SUBDIRS=$(LDIR) modules

clean:
rm -rf *.o *.ko *.mod.o *.mod.c
-------------

and the source code:

----------- mat.c ----------
#include <mat.h>
#include <complex.h>

int valor = 0;

int calculo(void)
{
valor = (int)creal(cexp(0));
return ++valor;
}
-----------------
--------- mat.h ----------
#ifndef MAT_H
#define MAT_H

extern int valor;

int calculo(void);

#endif
---------------------
---------- modu.c ------
#include <mat.h>
#include <linux/module.h>
#include <linux/init.h>

MODULE_LICENSE("GPL");

int __init modu_init(void)
{
int x = 1;

printk("<0>Carregou\n");
x = calculo();
return x - x;
}

void __exit modu_cleanup(void)
{
printk("<0>Descarregou\n");
}

module_init(modu_init);
module_exit(modu_cleanup);
----------

Am I can use "/usr/include/complex.h" or "math.h" in
the module, and link it with "-lm"? if no, how i can
get mathematics functions (sin, cos, exp) in kernel
space?

All helps will be appreciated!

Pecenin


__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger 
http://br.download.yahoo.com/messenger/ 

Received on 2005-08-09Z14:47:08