Applications and Geodes: 1.6 Geodes: Writing Your Own Libraries

Up: GEOS SDK TechDocs | Up | Prev: 1.5 Using Other Geodes | Next: 1.7 Working with Geodes

Creating a library geode is a simple step beyond creating a normal application. Libraries can have their own process threads or not; most libraries do not, though some will. To create a library geode, you have to do four things:

Defining a Library-the sound.gp File shows an example of the three changes you must make to the geode's parameters file to make it a library.

Code Display 7-1 Defining a Library--the sound.gp File

 # The Sound Library has the following three lines in its geode parameters file
# (sound.gp) different from how they might appear in an application.
#
# The permanent name of the geode might normally be sound.app if it is an
# application. A library typically has "lib" as its name extension.
#
name sound.lib
#
# Declare the type of the geode to be a library. Applications typically have a
# "process" aspect; many libraries do not. Libraries must also be declared to
# have a "library" aspect. (Note that the Sound Library is exceptional in that
# it has both a driver aspect and a library aspect.)
#
type driver, library, single
#
# Export the geode's entry point routine so the kernel may call it when the
# library is loaded. This routine must be defined somewhere in the geode's code.
# Note that it is exported with the "entry" line rather than the standard
# "export" line; this is to distinguish the exported routine as the entry
# point rather than a typical routine.
#
entry SoundEntry

Up: GEOS SDK TechDocs | Up | Prev: 1.5 Using Other Geodes | Next: 1.7 Working with Geodes