TNS/E Native Application Conversion Guide
TNS/E Native Application Conversion Guide—529659-003
8-1
8
Converting Programs That Run in
the Common Run-Time Environment
The Common Run-Time Environment (CRE) coordinates many run-time tasks on
behalf of the language-specific run-time libraries to provide 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 convert them to native mode.
This section describes the changes required to convert 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.) This section discusses:
•
Converting pTAL Programs to Run in the CRE
•
Specifying Header Files on page 8-2
•
Replacing Obsolete CRE Functions on page 8-2
Converting 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 convert 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 as main.
The C main function automatically initializes the CRE. Because the program now has a
C main function, you must link to the 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 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.










