22.12.2012 Views

z/TPF Program Management - IBM

z/TPF Program Management - IBM

z/TPF Program Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

|<br />

The previous example is the minimal amount that you need to code the CSO<br />

makefile. With no other changes, this defines the CSO as exporting all functions<br />

and having an entry named BILL.<br />

Like the BSOs, both the billing and base_rt environment files are listed. The<br />

base_rt environment file included with z/<strong>TPF</strong> is almost always required to<br />

enable the application program to access macros and includes that are included<br />

in z/<strong>TPF</strong>. The first environment listed defines the owning environment and,<br />

therefore, the corresponding environment file defines the directory (under the<br />

first root directory listed) that is used for writing listings, objects, and<br />

executables. Both environments are used to define where the source files<br />

(including macros and include files) are found.<br />

a. To define the CSO as a main program, add the following line to the makefile:<br />

APP_ENTRY := main<br />

b. To specify that there is only one entry point for this program and to make all<br />

other functions in the program local to the program, add the following line to<br />

the makefile: APP_EXPORT := ENTRY<br />

c. To define an entry point name, add the following line to the makefile. The<br />

value specified can be any function name or the CSO name: APP_ENTRY :=<br />

EntryName<br />

Note: You must add APP_ENTRY when APP_EXPORT := ENTRY is specified.<br />

If no entry is given, the CSO cannot be entered.<br />

d. To specify that all functions in the CSO can be called externally, no action is<br />

needed; APP_EXPORT := ALL is the default.<br />

Note: You also can specify APP_ENTRY with APP_EXPORT := ALL to define<br />

the entry point name. If no entry is given, the CSO cannot be<br />

entered.<br />

e. To limit the functions in the CSO that can be called externally, add the<br />

following line to the makefile: APP_EXPORT := LIST<br />

This requires that you also create an export file, which defines which<br />

functions are global or local. See “Create an export file” on page 69 for<br />

information about how to create the export file.<br />

An alternative way to limit the functions in the CSO that can be called<br />

externally is to use the -fvisibility compiler option. Specify<br />

-fvisibility=default to indicate that the functions in the CSO are identified<br />

as global for the shared object. Specify -fvisibility=hidden to indicate that<br />

all C/C++ functions are local except where they are coded with<br />

__attribute__((visibility("default"))).<br />

Note: You also can specify APP_ENTRY to define the entry point name. If<br />

no entry is given, the CSO cannot be entered.<br />

f. To call functions in other CSOs, the referenced CSOs must be listed in the<br />

calling makefile. The exception is for any of the CSOs that are defined as<br />

standard libraries, such as:<br />

v CISO<br />

v CLBM<br />

v <strong>TPF</strong>STUB<br />

v USRSTUB<br />

v CTIS<br />

v CTAL<br />

v CFVS<br />

Assemble, compile, and link (build) application programs 65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!