#: 9325 S12/OS9/68000 (OSK)
29-Jan-91 20:08:33
Sb: #9309-subroutine modules
Fm: Steve Adams 71610,3707
To: Bill Dickhaus 70325,523 (X)
Howdy! Since I use OSK subroutine modules a lot, I thought I would
throw in my two cents worth. I cannot speak for OS9 LII since I never
really used it in depth. Forgive me if I cover old ground.
First the advantages:
Advantage #1) Subroutine modules are an excellent way to expand
the functionality of a program at run-time. If the interface to the
subroutine module is properly defined, programs can use them to add
new features dynamically. (slight bragging follows) I wrote an object
oriented graphics editor for designing user interfaces that can be
expanded by the user to include new I/O objects. The new objects can
be edited as if they were hardcoded into the editor, including
rubber-banding, without making any changes to the graphics editor.
Advantage #2) An unlimited number of subroutine modules may be
used by a program at once. If trap modules are used, only 15
different modules may be used at once.
Advantage #3) As with any properly written OSK module, they may be
shared by several processes to reduce memory usage.
Now the disadvantages:
Disadvantage #1) This is probably the most frustating. No static
variable space may be used within the subroutine module. This limits
you to using stack variables, and 'malloc()'ed variable space. Some C
variables declared in cstart are accessable from a subroutine module.
Disadvantage #2) Because no global variable space is allowed, jump
tables are not allowed. This effectively limits the size of
subroutine modules to 32K. If you are REAL careful with your coding
and avoid distant 'bsr's, this size limit can be expanded.
Disadvantage #3) There is no standard interface to subroutine
modules that I know of. This makes its harder to get started
initially. This can also be viewed as an advantage once you know what
you are doing, since it allows your interface to the module to exactly
match your applications needs.
(continued in another message)
|