kuraga wrote:
Ok, but platforms (for example, posix) can't be compiled (without explicity pointing another standard library, too)
I am not sure I understand your point, here. There is only one standard library, ISO/IEC 9899. This library
requires some functionality to be provided from the underlying operating system. There needs to be a way to request memory. To open a file. To exit a process.
On POSIX, these are provided (by the operating system) via system calls. As system calls require assembly, they are wrapped in C functions -- mmap(), open(), and _exit(), respectively, with regards to the examples I gave (memory, file, end-of-process). Note, if you have a POSIX kernel, these functions
have to be available. Otherwise, you wouldn't have a POSIX kernel (and platform/posix would not be the right choice for you).
If your kernel is different, it might provide this kind of functionality under different names. But if it is to support the
standard library (ISO/IEC 9899), it needs to
have something along those lines. Yes, PDCLib needs to link against those, because
these are things no standard library could implement without assistance from the kernel.
You can
either implement your system calls directly in platform/<yourplatform>/functions/_PDCLIB/*.c (which I would not recommend as it would tie you in with PDCLib), or provide some "system calls" library to link against (and edit in the necessary includes, declarations, and/or function calls in platform/<yourplatform>).
Quote:
My fault. New version:
internals/_PDCLIB_glue.h: have declaration of int _PDCLIB_remove( const char * filename ); but we don't have a definition anywhere. (It's an internal function, they all have definitions, yeah?)
Ah. Indeed. Fixed.
kuraga wrote:
But what's the political differences between remove and (for example) rename?
With rename(), you have options. You could overwrite an existing file, or you could fail the operation, to name only one. Additionally, there usually
is no "rename" functionality at the kernel level. Look at the POSIX implementation -- it boils down to "set a link from new name to old name", followed by "unlink old name".
remove() is straightforward ("unlink old name"). You see the difference?
Nothing in this is written in stone, of course. There are not really any "rules" here. I just saw that I could break up rename() into primitives, but could not do so for remove(). Judgement call, really.