From: | Andrew Markwell |
Date: | 05 Aug 2000 at 23:44:12 |
Subject: | Re: (unknown) |
>From: "Paul Hill" <paul@lagernet.clara.co.uk>
>On 04-Aug-00 11:47:26, Bart King wrote:
> >Emanuele Cesaroni <emacesa@tin.it> wrote:
>
> >> I have written a shared library, and in some functions of its i call
> >> printf().... well when in the main program i open the lib and i call
>one
>
> >Quite simply, printf() uses stdout and in a shared library, stdin, stdout
> >and stderr are all NULL and not allowed.
>
> >If you want to use printf() in a shared library (and you must have a
>really
> >good reason to do so...) openfh=Open("CON:////", MODE_NEWFILE) a console
> >yourself, and use fprintf(openfh, "test");...
>
>I thought shared libraries can't do file IO directly? If I understand
>correctly you have to spawn a process to do the IO for you. I could be
>wrong though (perhaps this was in versions <= 1.3).
>
>If anyone knows the answer I'd love to know - a shared library I'm
>programming at the moment needs to read some config files.
>
I always thought it depended what you were calling the library function from
- a Process or a Task. The library function will usually be run on the
caller's context, so therefore if it is a process it will indeed have a file
handle to do DOS I/O.
Andrew Markwell
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com