Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

genso - generate a shared object

&pagelevel(3)&pagelevel

The genso command generates shared objects.

Syntax


/usr/bin/genso  [options] [files] 


options
genso accepts some of the options used for the POSIX C compiler; other options are derived from the ld command used on UNIX systems.

-L dir

Adds dir directory to the list of directories in which genso searches for libraries. The -L option must be specified before the -l option. The -L option is valid until a new -L option is specified.

-L bs2000_user_id

Only in connection with B plam: name of the BS2000 user ID.

The following specifications are possible:

$

stands for TSOS

.

(period) stands for the user ID under which the application is running

%name

if a BS2000 user ID is to be explicitly specified. The user ID must then be written in the environment variable name.

-l xxx

libxxx.a or libxxx.so will be used to generate a shared object. Which type of library is actually used depends on the actual use of –B static and –B dynamic. If nothing is specified, dynamic libraries have priority over static ones.

-l plam_library

Only in connection with B plam: name of the BS2000 PLAM library.

-m member

Only in connection with B plam: name of the BS2000 PLAM library member to be processed.

-o output

The name of the shared object to be generated. The shared object is stored under this name in the current directory. The extension of the file name should be .so; the .so file extension is not added automatically to the file name. To avoid misunderstandings, the suffixes .o and .a are rejected.

-B plam

From now on, PLAM libraries are processed. To switch to ar or so libraries, B ar must be specified.

-B ar

If PLAM libraries have been processed, then ar libraries or so libraries will be processed from now on.

-S low | -S high

Der Inhalt des Shared Object wird auf stdout ausgegeben.

Ist der Dateiname kein absoluter oder relativer Pfad, dann wird die Datei in den mit der Umgebungsvariablen LD_LIBRARY_PATH spezifizierten Verzeichnissen oder in /usr/lib gesucht. Bei der Anwendung auf eine Datei im aktuellen Verzeichnis ist also gegebenenfalls ein ./ voranzustellen, falls dieses Verzeichnis nicht in der Umgebungsvariablen LD_LIBRARY_PATH spezifiziert ist.

-S low gibt nur den Inhalt des aktuellen Shared Object aus.

-S high gibt zusätzlich zum Inhalt des aktuellen Shared Object noch den Inhalt aller abhängigen Objekte aus.


The contents of the shared object are output to stdout.

If the file name is not an absolute or relative path, the file is searched for in the directories specified with the environment variable LD_LIBRARY_PATH or in /usr/lib. When applied to a file in the current directory, a ./ may need to be prefixed if this directory is not specified in the  environmental variable LD_LIBRARY_PATH.

-S low only outputs the contents of the current shared object.

-S high in addition to the contents of the current shared object, outputs the contents of all dependent objects.

-X lang=c | lang=c++ | lang=cobol

Specifies the programming language of the object to be loaded. Mixed objects are possible.

Default value is lang=c .

-B static

When this option is given in the command line, static libraries (.a) have priority over dynamic libraries (.so).

-B dynamic

When this option is given in the command line, dynamic libraries (.so) have priority over static libraries (.a).

-B symbolic

Address resolution is effected when an object is loaded (via dlopen) and the sequence of resolving addresses is:

(1) the loaded program a.out

(2) all shared objects loaded before the actual object is loaded (RTLD_GLOBAL)

(3) the currently loaded object

-B symbolic not specified:

The resolution is effected in reverse order (3 - 2 - 1).

files

Only file names with .o file extension can be used (or with the name suffix .so when the -S option is used). Executable files must be renamed if necessary.

Files can only be specified after all options.

Exit status

The following exit values are returned:

0

Successful generation

>0

An error occurred

File

In the directory in which the output will be generated, a directory is temporarily generated and will be deleted when the command terminates.

Environment

Directories for libraries are searched with the following priority:

  1. directories contained in the variable LD_LIBRARY_PATH. If more than one directory is specified, the directories must be separated by colons (without blanks!).

  2. directories defined by –L option.

Example 1

Four Shared Libraries have to be generated: libtest21.so, libtest22.so, libtest23.so and libtest24.so.

The o files test21.o, test22.o, test23.o and test24.o are located in the current directory.

The shared objects libtest23.so and libtest24.so only comprise the o files test23.o and test24.o respectively.

The library libtest22.so consists of test22.o and the dependent shared object libtest24.so; the library libtest21.so consists of test21.o and the dependent shared objects libtest22.so and libtest23.so.

The following calls of genso are required to generate the shared objects:

genso -o libtest24.so test24.o
genso -o libtest23.so test23.o
genso -o libtest22.so -l test24 test22.o
genso -o libtest21.so -l test22 -l test23 test21.o

With the option S, you can view the contents of a shared object.

$ genso -S low   ./libtest21.so
analysis of shared object ./libtest21.so
shared object ./libtest21.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/test/reihentest/test21.o 
         dep. shared object libtest22.so (/home/bach/dll/test/reihentest/libtest22.so)
         dep. shared object libtest23.so (/home/bach/dll/test/reihentest/libtest23.so)
         option: -X lang=c

If you also wish to view the contents of the dependent libraries, S high must be specified.

$ genso -S high ./libtest21.so 
analysis of shared object ./libtest21.so
shared object ./libtest21.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/test/reihentest/test21.o 
         dep. shared object libtest22.so (/home/bach/dll/test/reihentest/libtest22.so)
         dep. shared object libtest23.so (/home/bach/dll/test/reihentest/libtest23.so)
         option: -X lang=c
analysis of shared object /home/bach/dll/test/reihentest/libtest22.so
shared object /home/bach/dll/test/reihentest/libtest22.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/test/reihentest/test22.o 
         dep. shared object libtest24.so (/home/bach/dll/test/reihentest/libtest24.so)
         option: -X lang=c
analysis of shared object /home/bach/dll/test/reihentest/libtest24.so
shared object /home/bach/dll/test/reihentest/libtest24.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/test/reihentest/test24.o 
         option: -X lang=c
analysis of shared object /home/bach/dll/test/reihentest/libtest23.so
shared object /home/bach/dll/test/reihentest/libtest23.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/test/reihentest/test23.o 
         option: -X lang=c

Example 2

A shared object with the name libp1.so must be generated from the following components:

  • from the member UNTEST1.O from the PLAM library $BACH.DL.LIB
  • from all members of the ar library libar.a and the o file file1.o.

The generation command is called up under the ID $BACH, and has the following format:

genso -o libp1.so -B plam -L . -lDL.LIB -m UNTEST1.O -B ar -L . -l ar file1.o

Here, -B plam -L . -lDL.LIB indicates that DL.LIB is a PLAM library located in the user ID under which genso is called up.

If you view the contents of libp1.so, you will see:

$ genso -S low ./libp1.so
analysis of shared object ./libp1.so
shared object ./libp1.so consists of
         Grossmodul ofile_GM_.o built of
                 objectmodule /home/bach/dll/newcommands/file1.o 
         arlibrary /home/bach/dll/newcommands/libar.a with elements 
                 objectmodule arfile1.o 
                 objectmodule arfile2.o
         plam library dl.lib with elements
                UNTEST1.O
          option: -X lang=c