[comp.os.os9] Question to OS9 Subroutine-Module

helau@nattdf (helmut Laufkoetter) (11/14/90)

Hello Netlanders,

can anybody out there give me some information about OS9 Subroutine-Modules?
preferrably written in C ? How can I call the functions? What is the structure
of such a module? What is about static storage and its initialization?
I'll be glad for any hint which will help me.

Helmut

kdarling@hobbes.ncsu.edu (Kevin Darling) (11/14/90)

>Can anybody out there give me some information about OS9 Subroutine-Modules?
>preferrably written in C ? How can I call the functions? What is the structure
>of such a module? What is about static storage and its initialization?
>I'll be glad for any hint which will help me.

An OS9 subroutine module is usually called as exactly that - a subroutine.
It's simply an extension of your main program code, shareable sometimes
by other programs (any written to pass vars the same way).

Your main program would link to the subroutine module, then JSR to the
execution offset returned by the link call (optionally, you could have
a branch table inside the subroutine module... there are no hard rules here).

A subroutine module has no static storage of its own.  Any code in there
uses either the stack, or variable addresses you pass from your main program.
BASIC programs have a defined way of passing variables to subroutine modules,
and I think there's a section in the MW manual on creating C subroutine
modules for BASIC to use. (?)  Other than that, everything is free style.

Unfortunately, I'm no C guru so I can't help a whole lot.  Would you be
calling these modules from a C program?  Or?  best - kev

 | Kevin Darling        | Internet: kdarling@catt.ncsu.edu   | OS-9 &
 | 919-872-7986 anytime | CIS: 76703,4227   Delphi:OS9ugpres | 680x(x)