Copy of: exporting functions from .gp file

Marcus Groeber (100712.270@CompuServe.COM)
XXX, 06 Sep 08:12:21 1996 EDT

[For some reason, this doesn't seem to have made it to the list...]

Hi Edward,

> optr _pascal MixerGetPrefUITree(void);
> void _pascal MixerGetModuleInfo(PrefModuleInfo *moduleInfo);

> Error MIXERP.GP 74: MixerGetPrefUITree undefined
> Error MIXERP.GP 75: MixerGetModuleInfo undefined

Any exported function in a library must be declared with the "_pascal _export"
keywords. "_pascal" will make sure the calling convention (how are parameters
passed? how do C routine names map to assembly names?) is correct, "_export"
will ensure that the data segment (global variables, constants) is available
while the routine is called from another application. It may appear to work
without "_export", but all kinds of strange results can occur... :-)

In addition, you should try to specify the names of the exported functions in
upper case if they are declared as "_pascal".

> #started with the hello3.gp file, didn't change this (yet) as it hasn't caused
> #a problem
> heapspace 3644

If this causes any problems at all, they will only appear when using it on
devices with "transparent detach" enabled (in other words: applications are
never terminated by the user, instead they are saved to stated in the background
if they haven't been used for a while) - most prominent example at the moment:
the OmniGo 100. The heapspace value can be determined using the heapspace
command of SWAT.

Geos uses this value to find out if a new application requires other to be shut
down before loading it. btw: I belive that if an application has no heapspace
value, it will be shut down whenever another app without heapspace setting is
started. I found this out when I tried a program which explicitly avoids
"transparent detach" on my OmniGo 100, and suddenly I was unable launch any
other programs that had no heapspace defined.

Another note: I think that the value in the hello3 sample from the non-OG SDK
2.0 is probably too big - it says there that the value is specified in "words"
(double bytes???), but the more up-to-date documentation in the OmniGo SDK
specifies it to be in "paragraphs" (16 byte chunks). To be on the safe side, one
can use the suffix "k" to indicate that it should be treated as kilobytes (e.g.
"heapspace 7k").

ciao marcus