Previous Page Contents Page Next Page

2.7 Solaris Environment Considerations

This section summarizes processing considerations of which you must be aware when developing LUA applications on a Solaris computer.

2.7.1 LUA Header File

The header file to be used with LUA applications is /usr/include/sna/lua_c.h. This file contains the definitions of the LUA entry point and the LUA VCBs. It also includes the common interface header file /usr/include/sna/values_c.h; these two files contain all the constants defined for supplied and returned parameter values at the LUA interface. The file values_c.h also includes definitions of parameter types such as AP_UINT16 that are used in the LUA VCBs.

2.7.2 Multiple Processes and Multiple Sessions

If the process that issued RUI_INIT then forks to create a child process, the child process cannot issue any LUA verbs on the session started by the parent process; the verbs will fail with return codes LUA_UNSUCCESSFUL and LUA_INVALID_PROCESS . It can, however, issue another RUI_INIT to obtain its own session.

A single process may simultaneously use more than one LUA session, by issuing multiple RUI_INIT verbs. Each session must use a different LU, but two or more sessions may use the same pool.

Two or more instances of the same LUA application can be run as different processes, but they must use different LUs. This can be done either by providing a mechanism for specifying the LU name at run time, or by using LU pools; if the two processes specify the same pool, they will be allocated different LUs from that pool.

2.7.3 Compiling and Linking the LUA Application

Applications are compiled with different options in order to select one of the scheduling modes described in Scheduling Asynchronous Events.

Note

Applications that use asynchronous API callbacks must either be built as multithreaded applications or include support for the application scheduled mode. Motif applications must include the code fragment described in Motif Applications.

Applications linked with previous versions of SNAP-IX that used signal-based scheduling mode provided by the library, libmgr.so, will continue to work in the current version of SNAP-IX. However, this library is provided only for back-compatibility. New applications should not use this library.

When compiling your LUA application, use the following options:

/usr/include/sna

Indicates the directory containing one or more header files your application requires.

Specifies use of the sparcv9 (64-bit) architecture instruction set. Use this option if you want to compile the application in 64-bit mode. To compile in 32-bit mode, do not specify this option.

When linking your LUA application, use the following options:

Specifies use of the sparcv9 (64-bit) architecture instruction set. Use this option if you want to link the application in 64-bit mode. To link in 32-bit mode, do not specify this option.

Indicates the directory containing one or more libraries to be used when linking the application.

This directory is normally /opt/sna/lib, except for 64-bit applications where it is /opt/sna/lib/sparcv9.

Indicates the name of a library to be used when linking the application.

Indicates the directory containing one or more libraries to be used by the application at run time. This directory is normally /opt/sna/lib, except for 64-bit applications where it is /opt/sna/lib/sparcv9 .

As an alternative to the option, you can set the environment variable LD_RUN_PATH to /opt/sna/lib or /opt/sna/lib/sparcv9 before compiling and linking the application.

Indicates a preprocessor directive to be used by the compiler. Do not include any space between and the name of the preprocessor directive.

The command you use to link the application depends on which type of application it is, as described below.

Linking Motif Applications and Applications That Use Application Scheduled Mode

For a 64-bit application, link with the following options:


-xarch=v9 -L /opt/sna/lib/sparcv9 -R /opt/sna/lib/sparcv9
 -llua -lsna

For a 32-bit application, link with the following options:

-L /opt/sna/lib -R /opt/sna/lib -llua -lsna

Notes

  1. If you are using the standard Solaris compiler /usr/ucb/cc, you may encounter compiler errors indicating that the library libucb.so.1 could not be found. If this occurs, add /usr/ucblib to the compiler options you use to link the program.

  2. Check your Motif documentation for information on which libraries and other options are required to link your Motif application.

Linking Multithreaded Applications

For Solaris, a multithreaded application can use either Solaris threads or POSIX threads. Refer to the Solaris Programmer's Guide for multithreaded programs for more information on using each type of threads. The following options are suitable for linking most applications:

-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L /opt/sna/lib -R /opt/sna/lib -llua -lsna_r -lthread

For a 64-bit application, link with the following options:

-xarch=v9 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L /opt/sna/lib/sparcv9
 -R /opt/sna/lib/sparcv9 -llua -lsna_r -lthread

Note

If you are using the standard Solaris compiler /usr/ucb/cc , you may encounter compiler errors indicating that the library libucb.so.1 could not be found. If this occurs, add /usr/ucblib to the compiler options you use to link the program.

Previous Page Contents Page Top of Page Next page