Re: C runtime library for Unix



Paul Edwards wrote:
I would like to port PDPCLIB:

http://sourceforge.net/projects/pdos/

my public domain C runtime library for DOS, OS/2,
Win32, MVS to Unix now.

I am a bit perplexed as to how to do this. Unix/Posix
systems provide open() with which I can implement
fopen(). But then Posix is also required to define fopen(),
so this is not the level at which I need to implement it.

Although I don't think the CRT should be polluting the
namespace by using open() in the first place.

If the lower level is platform-dependent, then the platform
I wish to target is Linux.

Can someone get me started?

As a system library, you'll need to only rely on the APIs exported by
the OS. Linux aims towards POSIX compliance and thus implements many
APIs defined by POSIX. The system C library often also provides POSIX
interface.

In general you should try to do as much as possible within standard C
and write specific functions when they're called for. If you want the
library to port to most UNIXes, it's structure and compilation will get
more involved. If it's specifically for Linux, then it'll be much
simpler.

At a minimum you'll need to refer to the C standard, the POSIX
standards and the man 2 pages for the OS API. The tricky part will be
satisfying the OS without sacrificing too much portability.

Post Linux API related questions to one of the Linux groups. Details
within standard C portions can be discussed here or in comp.std.c, (but
I doubt that those areas would be much of a problem for you).

The Linux newsgroups will probably help you best. Also browse the
sources of C libraries like dietlibc etc.

.



Relevant Pages

  • Re: How Common Lisp sucks
    ... Except that Linux has a process for managing change, ... The POSIX standard is analogous to the hyperspec. ... the Posix community has processes for developing and evolving ...
    (comp.lang.lisp)
  • Re: Shared memory Question using shmctl()
    ... Linux neither is a real UNIX nor offers a complete POSIX implementation. ... The Linux Standard Base even violates ... conforming documentation you might want to visit the opengroup, ...
    (comp.unix.programmer)
  • Re: large files: when ubiquitous?
    ... > |> interfaces that applications see, not interfaces libraries use directly ... The posix interface mandates an int return from lseek. ... Today that doesn't happen on Linux (but it does on some ... When you compile using standard linux and posix headers, ...
    (comp.os.linux.development.system)
  • Re: Standard way of graphics in Linux
    ... Well X is _the_ standard, if you do not like X you can use svgalib. ... of graphics in Linux". ... Many systems are _NOT_ x386 in Linux, so forget about binaries that run on the fly on ... There are a few _extremely_ simple universal graphics libraries that are fast, ...
    (comp.os.linux.development.apps)
  • Re: c# or Java???
    ... that programmers should have a choice, ... Just like you get nowhere using the standard C ... > using POSIX already drops you out of plenty non-POSIX OSes ... > libraries. ...
    (comp.programming)