Using standard headers in my kernel

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ATI76

Using standard headers in my kernel

Post 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)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Using standard headers in my kernel

Post 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...
Every good solution is obvious once you've found it.
ATI76

Re:Using standard headers in my kernel

Post 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).
User avatar
Pype.Clicker
Member
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

Post 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 ...
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Using standard headers in my kernel

Post by Solar »

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 ...
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...
Every good solution is obvious once you've found it.
ATI76

Re:Using standard headers in my kernel

Post 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.
Post Reply