home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.apollo
- Path: sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo.hp.com!netnews
- From: ced@APOLLO.HP.COM (Carl Davidson)
- Subject: Re: Making /lib/xmlib1.1 a global library in SR10.4
- Sender: usenet@apollo.hp.com (Usenet News)
- Message-ID: <BxtEAK.Hn1@apollo.hp.com>
- Date: Mon, 16 Nov 1992 15:13:32 GMT
- References: <1992Nov7.033430.26974@nrtpa038.bnr.ca> <1992Nov13.215059.1429@hpcvusn.cv.hp.com> <BxoDqw.ss@apollo.hp.com>
- Nntp-Posting-Host: watson.ch.apollo.hp.com
- Organization: Hewlett-Packard Company, Chelmsford, MA
- Lines: 53
-
- In article <BxoDqw.ss@apollo.hp.com>, ganek@apollo.hp.com (Dan Ganek) writes:
- |>
- |> Tom, the main routine of a global library is executed for EVERY process that
- |> is started whether it uses it or not. For that reason, global libs should NOT
- |> have a main() unless it is absolutely necessary.
- |>
- |> (At least that's what I rememebr from the good old days)
- |>
- |> /dan
-
- [ sound of dust being shaken off Aegis programming skills deleted... ]
-
- If you need to do any library initialization, a main() routine
- (more appropriately called an "init" routine) is indispensible.
- There are two things to note:
-
- 1. Use rws_$alloc_heap_pool() to allocate any storage needed for
- data which must be globally accessible. For the pool to allocate
- from, use rws_$global_pool. This way the data will be correctly
- mapped in all processes.
-
- 2. The library's init routine needs to do the following:
-
- void foo_init(status_$t *status,
- boolean global_init)
-
- {
- if (!global_init) {
- status->all = status_$ok;
- return;
- }
-
- /*
- * put your library initialization here...
- */
-
- if (initted OK) {
- status->all = status_$ok;
- } else {
- status->all = error code;
- }
- }
-
- This way, the initialization code will only get executed
- once, at boot time.
-
- Have fun.
-
- --
- Carl Davidson (508) 436-4361 |
- Chelmsford System Software Lab | Microkernels: Where less is more.
- The Hewlett-Packard Company |
- DOMAIN: ced@apollo.hp.com |
-