Huang Qiang wrote:
>
> I am using RTL 2.2 now .
> I need atoi and sprintf function in my RT task, but failed.
>
> I test it by insert some code into RTL2.2 example frank .
>
> 1. include the stdlib.h
> 2. insert follow lines into thread_code
>
> /*==================================================*/
> char test_sprintf[16];
> int test_atoi;
>
> sprintf(test_sprintf, "%d", fifo);
> rtl_printf("test_sprintf is %s\n", test_sprintf);
>
> test_atoi = (int)atoi(test_sprintf);
> rtl_printf("test_atoi =%d\n", test_atoi);
> /*==================================================*/
>
> 3. do make then insmod frank_module.o , but failed in
>
> frank_module.o: unresolved symbol __strtol_internal
>
> 4. so I did "ld -r -o mod.o frank_module.o -L/usr/lib -lc"
> then insmod mod.o , but failed , too .
>
> What's wrong , can someone point me.
>
Hi Huang,
In general you shouldn't include user space header file in kernel
modules. You should limit them to the the ones that start with 'linux'
or 'asm'.
For sprintf, include <linux/kernel.h>, I'm not sure about atoi, you may
have to roll your own
Regards, Stuart.
-- [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/