using librarys in your os?

Programming, for all ages and all languages.
Post Reply
User avatar
Sam111
Member
Member
Posts: 385
Joined: Mon Nov 03, 2008 6:06 pm

using librarys in your os?

Post by Sam111 »

I am wondering if I can compile/link a library one of the standard c libraries into my os.
I always compile/link with nodefaultlibs switch so that my output kernel.bin file doesn't depend on any outside dll ,...etc
My whole os is written from my functions...etc no outside libraries but now I am wondering if I can use outside libraries and what the extend of using outside stuff is? Plus how to use outside libraries in my os if it is possible duno maybe all it takes is adding the library with a linker switch at command line to ld.


My problem now is
is their away to compile/link a library and all it's dependences into my kernel.
In theory what would go wrong in compiling all the microsoft dll's ,...etc into my kernel won't it just have all the functionalites of microsofts os's ?

Either way I am new to compiling third party dll into a kernel what can go wrong?
I have my linker script set to binary output so if I provided the libraries on the command line to ld will it copy all the dependences of those libraries,..etc into my kernel.bin

Will I be all set or will their still be dependences , errors , problems in my kernel from this that I am not aware of???
Gigasoft
Member
Member
Posts: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: using librarys in your os?

Post by Gigasoft »

Most of the functionality depends on Windows. There are only a very few functions that don't depend on anything else, such as strcpy, strlen, etc. Everything nontrivial ends up depending on the entire Windows kernel in some way or another.
User avatar
Sam111
Member
Member
Posts: 385
Joined: Mon Nov 03, 2008 6:06 pm

Re: using librarys in your os?

Post by Sam111 »

Even if you just want to compile math.h , cmath, or cstring , string.h ,....the standard c/c++ libraries not stuff that depends on the os or drivers to display it ,...etc etc?

And why would it fail if you tried to compile/link the whole windows kernel functions and libraries and everything?

Question 2 if I made my own library that didn't depend on any other libraries would includeding it for the linker to link with my kernel cause any problems? In my kernel.bin...

I am just get confused on what can be linked into your kernel and what cann't ?
And how to tell if it can or cann't be used. Seems the math.h is pretty independent?

Thanks
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: using librarys in your os?

Post by gerryg400 »

Even if you just want to compile math.h , cmath, or cstring , string.h ,....the standard c/c++ libraries not stuff that depends on the os or drivers to display it ,...etc etc?

And why would it fail if you tried to compile/link the whole windows kernel functions and libraries and everything?

Question 2 if I made my own library that didn't depend on any other libraries would includeding it for the linker to link with my kernel cause any problems? In my kernel.bin...
The sentence that claims to be question 2 follows 2 previous sentences with question marks. So it would be question 3. But I notice you left the question mark off in the final sentence.

My answer to all your questions is to follow the wiki recommendation to beginners to use newlib.
If a trainstation is where trains stop, what is a workstation ?
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: using librarys in your os?

Post by montrom »

When a question begins with, "If I", then you should be able to answer it by simply trying it out yourself. And, obviously you should write your own code.
Visit the Montrom user page for more info.
Post Reply