On 24 Aug 2006 at 21:10, Frank Heckenbach wrote:
[...]
It might also work to just add the new library, and just let gpc.c pass -lgpc. If your library comes first, its declarations should take precedence, and if no declaration from libgpc.a is used it's simply ignored by the linker.
Actually, one doesn't need a library for that. A plain unit using the appropriate linker names (or just embedding the code in the main program, as I just tried) will do. See the attached typescript.
The first example shows what happens when some of the linker names don't match -- though the messages are a bit surprising at first glance. The linker will pull the missing declarations from libgpc.a, thereby linking the library, and thus get duplicate symbols for the other (matching) linker names. So, this is a kind of warning against inadvertently using libgpc.a (though the executable size will tell you anyway).
The second example, matching the RTS version check (to my current GPC development number, yours will be different) works and produces a small exectuable. For comparison, the third example, compiling an empty file. (So removing code makes the executable bigger, isn't it funny? ;-)
Indeed. But this is a brilliant idea. I will give it a go.
- Would there be any mileage in producing a libc standard unit?
libc is a rather vague term here. Such a unit could be anything from a non-portable interface of the 6 most important libc calls (open, close, read, write, fork, exec, according to Linus ;-) to a fully portable interface to all known libc's on this planet, with interface to all functions supported by any of them plus emulations/errors where not supported ...
"Standard" GNU libc, if such a thing exists.
Actually I'm not sure if GNU libc on different platforms provides exactly the same features, or some non-portable ones as well, though one could omit the latter here if they exist.
That's quite a large beast already, and as I said rts.c only covers a part of it yet. If you like to extend it, go ahead, but of course, for inclusion into the RTS (whether the same or a new unit) we can't support GNU libc only, which means adding a lot of autoconf checks (which is actually sometimes the most work when adding a new function there).
I think rts.c would be excellent, if it could be made entirely self- contained. I ran a "configure" on the rts directory and then built rts.c into rts.o. However, attempting to link it produced errors (because there were declarations from error.pas and some other .pas files). Is it possible to have a fully self-contained rts.c ?
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Web: http://www.greatchief.plus.com/