Page 1 of 1

Your own LibC

Posted: Sun Nov 20, 2005 2:42 pm
by Juye
hey!

i'm trying for a while now to port one of the more popular libc's (dietlibc, msvc libc - not free) but each of the libraries is such a major project to project i just refuse to do it.

dietlibc is completly linux oriented and in the faq it is even considered "not portable" besides for linux+gcc. msvc is.. no need to say, windows oriented and its hard to cut apart only the parts I need (complete FILE* emulation, and all the around utils need to support it).

I just had to ask, aren't you guys using your own libc? isn't there a *free*, *portable* (using gnu gcc __attribute__ combinations everywhere is not much of a compiler portability) libc that I can easily use? what are you guys using for your os?

sure, I'm not looking for c99 / c++ / posix compatibility... I just want those goddamn fprintf, fscanf, scanf, printf, getch, ungetch, fwrite, fread, fclose, fopen, and all the weird variations used by stdio/stdlib so my OS could actually support some applications, sure I have my "native" os support files but there are not much use if I want to run existing projects on my os.

I managed to strip from dietlibc some stuff, but there must be some place some one who thought about it and made a libc where all you need to do is replace the base functionality, (only the actual workhorse _open for file, or _read for a file etc)

thanks!

Re:Your own LibC

Posted: Sun Nov 20, 2005 3:03 pm
by Candy
Try pdclib, which is maintained by our moderator called Solar. He's a very nice chap who'll love to get you working on it. It's intended to be ported to new operating systems.

Re:Your own LibC

Posted: Sun Nov 20, 2005 5:37 pm
by Juye
What is that libc? is it operational?

what libc do you use Candy?

.. and others?

I'm heavy at work converting almost entirely djgpp dos libc to my os combining msvc6 libc here and there (naturally excluding os specifics) . its a pain, they all look so hacky, I guess the standard is really messy, looking at the implementations.

Re:Your own LibC

Posted: Sun Nov 20, 2005 6:28 pm
by durand
A while ago, I set out with great enthusiasm to build a portable unix library (posix, libc, etc) compatible library and my work can be found at: http://www.djm.co.za/spoon/libUNIX.php

It's not great but it's good enough to compile some common apps and libraries like libpng, zlib, a few small apps. It's supposed to be portable as well. I've kept the OS specific stuff in it's own subdirectory.

There's a lot of stuff I'd like to change but perhaps it would help..

Re:Your own LibC

Posted: Sun Nov 20, 2005 11:57 pm
by Candy
Juye wrote: What is that libc? is it operational?

what libc do you use Candy?

.. and others?
Well... I'm not using a libc at this moment, I do have a pdclib on my disk to be able to start using it when I feel like it. My OS doesn't allow C programs to be run right now, and it will not do so in the near future.

I will need it for C++ however. But, that also requires an STL and a very specific library set for my OS, which is far from finished. So, I'll finish that first :). Yes, I'm working on it occasionally, so it isn't progressing very fast...
I'm heavy at work converting almost entirely djgpp dos libc to my os combining msvc6 libc here and there (naturally excluding os specifics) . its a pain, they all look so hacky, I guess the standard is really messy, looking at the implementations.
Don't guess about the standard, Google for it. By the way, you can't download it (so you can't follow those links officially). The only fully legal way is to go to ISO or ANSI and to buy the standard for a few thousand euros.

Needless to say, I'm not expecting that you go and pay that.

Re:Your own LibC

Posted: Mon Nov 21, 2005 12:31 am
by Solar
Juye wrote: What is that libc? is it operational?
Pre-Alpha. It has all headers required by a "freestanding" implementation (i.e. all those that carry #define's and typedef's only), plus <string.h>. It's not much yet, but it's PD, it's as portable as I could make it, and I will continue working on it. Yesterday I wrote a couple of test drivers and fixed two bugs in <string.h>, and I feel like this week will see a bit more work on the subject.

Re:Your own LibC

Posted: Mon Nov 21, 2005 2:01 am
by Solar
*cough* *cough*

Perhaps you should wait until v0.3 of PDCLib is released, my <string.h> seems to be a veritable bug's nest, as I found when writing the rest of the test drivers this morning... ::)

Edit: v0.3 released.