Page 1 of 1
Using standard headers in my kernel
Posted: Wed Aug 11, 2004 5:55 am
by ATI76
Just a quick question. I?d like to use some functions from cmath in my kernel, like isnf(double). But how can I achiev that? I tried using include <cmath.h>, and then I try to link cmath into my project using something like
ld -T link.ld -o kernel.bin [All kernel files] [c:\djgpp...\cmath] (I think the object file is called plain cmath)
but it doesnt not work att all. How can I do this? Im using DJGPP (windows xp)
Re:Using standard headers in my kernel
Posted: Wed Aug 11, 2004 6:10 am
by Solar
ATI76 wrote:
Just a quick question. I?d like to use some functions from cmath in my kernel, like isnf(double). But how can I achiev that?
By writing your own standard library, or porting an existing one.
You can't simply take the standard library that comes with your compiler (which might be a PE library targeted at Windows, or an ELF library targeted at Linux) and link it into your kernel, which might have a completely different binary format, system call syntax, environmental setup etc. etc....
Welcome to kernel land...
Re:Using standard headers in my kernel
Posted: Wed Aug 11, 2004 6:24 am
by ATI76
Alright, thank..
cause I read somewhere that it was only runtime-functions such as malloc and stuff that have to be rewritten. Anyways, you know any place where I can get the source for "standard functions"? What I need now is functions like isinf and other math functions (so I can print a nice "infinity" when someone tries to print an expression like 1/0 or something).
Re:Using standard headers in my kernel
Posted: Wed Aug 11, 2004 6:33 am
by Pype.Clicker
http://cvs.sourceforge.net/viewcvs.py/p ... des/math.h from the 'PDC lib' may help you, but i dunno how "useable" the PDClib has become ...
Btw, i'm quite curious to know why in hell you need floating infinite in a kernel ...
Re:Using standard headers in my kernel
Posted: Wed Aug 11, 2004 6:57 am
by Solar
Not usable at all, I am afraid,
especially in the math sector. There's no math logic whatsoever yet in the PDCLib.
I've focussed on Astyle for a while, and will for some time to come, as the interest there is much higher; sorry.
As for freely available math code... I'm afraid GPL code is the best you can hope for...
Re:Using standard headers in my kernel
Posted: Wed Aug 11, 2004 7:33 am
by ATI76
Alright thank you guys
Pype: It?s not only for the kernel, it?s principally for my printf function which I plan to use (a bit modified of course), in applications running in my system.