Shared Libraries

LayGO for RTX packages the LayGO API as RTSS DLLs. This allows an application to be linked against an export library in the usual way. However, the RTSS DLLs must be explicitly loaded into the RTX subsystem before they can be used by an application. There are 2 DLLs:

The shared libraries are located in the lib directory of the LayGO for RTX distribution. That directory also contains the export libraries laygo32h.lib and laygo32m.lib which the application should link to.

To load the shared libraries into the RTX subsystem, use the rtssrun utility:

    > rtssrun laygo32m.rtss
    > rtssrun laygo32h.rtss [-v] [-s <service database>] [cfg file list]

The shared libraries can also be loaded directly by the application as demonstrated in the RTSS DLL Code Example which is part of the RTX SDK.

Note: When laygo32h.rtss is loaded, it internally configures, initializes and enables the LayGO protocol stack. It will also explicitly initialize the service database.

The application may NOT call any of the following functions:

They are not exported from laygo32h.rtss.

If laygo32h.rtss fails to configure or initialize the stack successfully, it will write an error message to the RTX server console and immediately exit with a non-zero return value. The -v option may be used to enable more verbose output. The default service database for laygo32h.rtss is c:\laygo\cfg\service.db. That file must be present unless a different file is specified on the command line with the -s option. If the application does not use the service database, it can be empty, but it must exist.

Caution: Both data and code of RTSS DLLs are shared by all applications, and the DLLs are not automatically unloaded when an application terminates. This means that applications must be careful to correctly clean up before exiting. In particular, any open LayGO LCids must be closed. If the application does not correctly clean up (for instance, if it aborts due to an exception), laygo32h.rtss may need to be manually reloaded. To do this, use the laygoctl.exe utility (NOT rtsskill):

    > laygoctl laygo32h
    > rtssrun laygo32h.rtss [cfg file list]

This will cause laygo32h to perform a graceful shutdown and reinitialize. The graceful shutdown is necessary to insure that all ISRs are uninstalled and all operating system resources are released. laygoctl can also be used to unload laygo32m.rtss:

    > laygoctl laygo32m

laygoctl.exe is a Win32 program. The same program is provided as an RTX executable, laygoctl.rtss. The functionality is the same as laygoctl.exe except that it executes in the RTX subsystem:

    > rtssrun laygoctl.rtss laygo32h laygo32m

laygo32h.rtss contains the hardware driver. For testing purposes, another version which contains the hardware emulation driver is also provided. This is located in the lib\emulator directory of the LayGO for RTX distribution. To use the emulation driver, load lib\emulator\laygo32h.rtss with cfg\stack6.cfg as the stack configuration file.