TNS/R Native Application Migration Guide

TNS/R Native Application Migration Guide523745-001
8-1
8
Common Run-Time Environment
(CRE) Migration Tasks
The CRE coordinates many run-time tasks on behalf of the language-specific run-time
libraries, thus providing a common environment for all routines in a program,
regardless of their languages. Most programs use CRE services implicitly by calling
language specific run-time libraries, such as the C run-time library, which in turn call
the CRE. You do not need to change TNS programs that use CRE services implicitly to
migrate them to native mode.
This section describes the changes required to migrate applications that make explicit
use of CRE services; that is, programs that make explicit calls to the CRE_, RTL_, and
CLU_ functions. TAL ‘main’ routines that run in the CRE make explicit use of CRE
services and require changes. (Most programs with a TAL ‘main’ routine do not run in
the CRE.) Topics in this section are:
Changing pTAL Programs to Run in the CRE
Specifying Header Files on page 8-2
Replacing Obsolete CRE Functions on page 8-2
Changing pTAL Programs to Run in the CRE
A program with a TAL main routine that runs in the CRE calls the
TAL_CRE_INITIALIZER_ procedure to initialize and establish the CRE. There is no
equivalent procedure for pTAL. Therefore, a pTAL procedure cannot be the main
procedure in a program that runs in the CRE. To migrate a program that runs in the
CRE from TAL to pTAL:
Delete the call to TAL_CRE_INITIALIZER_.
Delete the MAIN keyword from the main procedure.
Write a simple C ‘main’ function that calls the pTAL procedure that previously was
declared ‘main’.
The C main function automatically initializes the CRE. Because the program now has a
C main function, you must link to the shared run-time libraries (SRLs) and CRTLMAIN
module required by native C programs. See the CRE Programmer’s Guide and C/C++
Programmer’s Guide for details.
Unlike the TAL compiler, which requires an ENV COMMON or ENV NEUTRAL
directive for programs that run in the CRE, the pTAL compiler does not require any
ENV directives. The pTAL compiler issues a warning for any ENV directives that it
finds. Remove ENV COMMON and ENV NEUTRAL directives from pTAL programs.