From: | Gregory Roberts II |
Date: | 02 Aug 99 at 04:28:19 |
Subject: | Re: Re: (no subject) |
From: Gregory Roberts II <gregr@en.com>
On Sun, 1 Aug 1999, Allan Odgaard wrote:
> From: Allan Odgaard <Duff@DIKU.DK>
>
> On 31-Jul-99, Gregory Roberts II wrote:
>
> > [...]
> > A shared library is just that: shared by many processes. Therefore, it
> > doesn't have the context that dos.library needs to operate.
>
> I don't think this is entirely true. A library function should be viewed as an
> extension of a program, thus has the process-structure of the calling program.
> So most DOS functions are callable from a library, granted that library has
> been called from a process, even though many DOS functions can actually be
> called by tasks.
You're right. Usually you can get away with it because libraries are
almost always called by Processes, so dos.library just uses the calling
process. I can't say whether most DOS functions can be called by tasks.
The rule I always heard was that you must be a process to call
dos.library, and to do anything else wasn't system-friendly.
Personally, I don't like to assume what context my libraries are going to
be called from, especially since I love creating new tasks. :-) So, I
leave the dos.library stuff for the main application.
> I think that the only real unsafe thing to do in a library is start printing to
> stdout, as the process is likely not to have a stdout, plus 'printf()' doesn't
> seem to be re-entrant, atleast not in StormC... :-( But kprintf() works very
> well from libs :-)
Printing to stdout is definitely unsafe on the Amiga, and printf is
notoriously non re-entrant. (And a couple of other things too! :-)
>
> Regards Allan
>
Greg