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)
Using standard headers in my kernel
Re:Using standard headers in my kernel
By writing your own standard library, or porting an existing one.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?
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...
Every good solution is obvious once you've found it.
Re:Using standard headers in my kernel
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).
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).
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Using standard headers in my kernel
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 ...
Btw, i'm quite curious to know why in hell you need floating infinite in a kernel ...
Re:Using standard headers in my kernel
Not usable at all, I am afraid, especially in the math sector. There's no math logic whatsoever yet in the PDCLib.Pype.Clicker wrote: 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 ...
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...
Every good solution is obvious once you've found it.
Re:Using standard headers in my kernel
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.
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.