Write comments

Whether i need my own library in OS ?

7. Mar 2017, 15:29

I tried to write a quite well and clean OS. In the end of writing codes and release version 1.0, do i need to write any library for that ? like Windows API . :geek:
I want to developers feel free to write applications for my OS.

7. Mar 2017, 15:29

Re: Whether i need my own library in OS ?

8. Mar 2017, 10:06

well if you support all the usual stuff (open/close files, write to stdout, read from stdin etc.) via syscalls, then your users can just use syscalls, but it would be nice for them if you give them a library that provides a nicer API to the syscalls. Something like
Code:
int fopen(char* filename, int flags, int mode)
{
    int filedescriptor;
    asm("int $0x80" : "=a"(filedescriptor) : "a"(5), "b"(filename), "c"(flags), "d"(mode));
    return filedescriptor;
}
...


Then the users can statically link to that library and call fopen etc. as they are used to.
When they compile their programs, they need to turn off exceptions, disable linking dynamically against the usual libraries (glibc, glibc++ etc.) and statically link against your library instead.

Don't forget: you still need some way to start the programs. Reading something from the hard drive and attaching a function pointer to your processes list is discussed in the tutorials, but after reading the executable binary into ram, which function pointer do you attach to the processes? I would suggest that you implement the ELF file format, so that your users can just use gcc to compile (if you make up your own format, then you need to give your users a cross compiler).
Write comments




Bei iphpbb3.com bekommen Sie ein kostenloses Forum mit vielen tollen Extras
Forum kostenlos einrichten - Hot Topics - Tags
Beliebteste Themen: NES, Mode, Linux, Rap, Programm

Impressum | Datenschutz