Previous Page Contents Page Next Page

2.4 Compiling and Linking the MS 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 MS 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 MS 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.

2.4.1 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
 -lms -lsna

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

-L /opt/sna/lib -R /opt/sna/lib -lms -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.

2.4.2 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 -lms -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 -lms -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