Article View: comp.sys.amiga.tech
Article #12590Re: File Requesters
From: Eric Green
Date: Thu, 11 May 1989 06:05
Date: Thu, 11 May 1989 06:05
35 lines
2406 bytes
2406 bytes
in article <6374@ardent.UUCP>, rap@rap.ardent.com (Rob Peck) says:
[lots of stuff about file requesters... then:]
> clear enough in the original posting. And if one makes the file
> requester code a part of a sharable (reentrant) library, the function
> "malloc" could be used to allocate these buffers in the first place
> so that the user code need never even "free" the buffers on exit
> since this is usually done when a program exists anyhow. Of course
Uh, Rob, slight problem here. "malloc" works somewhat like the
Intuition function "AllocRemember", i.e., it calls AllocMem and then
adds an entry into its memory list. The pointer to its memory list is
in the program's static memory, and the address of that pointer is
hard-wired into "malloc" and "exit" at link time. A shared library's
copy of "malloc" will thus have a different RememberList than the
program's copy of "malloc"... meaning that when the program's copy of
Exit goes and cleans up the RememberList, it will only clean up the
stuff allocated by the program's copy of "malloc", not by the shared
library's.
What this means is that any call to malloc will have to be done in the
link library/calling program, not in the shared library. No big deal,
really... just put a wrapper around it. As far as the programmer's
concerned, he's just calling "FileRequest" with a bunch of parameters
(or maybe a struct, considering that's what most Amiga OS functions
expect ;-) The fact that his wrapper is malloc'ing the needed buffers
shouldn't be something he should worry about (unless he has already
allocated his own buffers and doesn't want the "malloc" routine linked
into his program....).
--
| // Eric Lee Green P.O. Box 92191, Lafayette, LA 70509 |
| // ..!{ames,decwrl,mit-eddie,osu-cis}!killer!elg (318)989-9849 |
| // Join the Church of HAL, and worship at the altar of all computers |
|\X/ with three-letter names (e.g. IBM and DEC). White lab coats optional.|
Technical Details
Message-ID:
<8077@killer.Dallas.TX.US>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!texsun!pollux!killer!elgReferences:
<6374@ardent.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!texsun!pollux!killer!elg From: elg@killer.Dallas.TX.US (Eric Green) Newsgroups: comp.sys.amiga.tech Subject: Re: File Requesters Message-ID: <8077@killer.Dallas.TX.US> Date: 11 May 89 06:05:33 GMT References: <6374@ardent.UUCP> Distribution: na Organization: The Unix(R) Connection, Dallas, Texas Lines: 35