TNS/E Native Application Conversion Guide
Converting a TNS User Library
TNS/E Native Application Conversion Guide—529659-003
6-2
Building a User Library
Building a User Library
Building a TNS/E native user library is similar to building a TNS user library. To build a
TNS/E native user library:
1. Remove pragmas and directives:
•
In C and C++, remove ENV LIBRARY pragmas from source code files and the
compiler RUN command line.
•
In COBOL and pTAL, remove ENV LIBRARY directives from source code files.
2. Add pragmas, directives, and flags:
•
In C and C++:
°
In the Guardian environment, add a CALL_SHARED pragma to the
compiler RUN command line.
°
In the OSS or PC environment, add the -Wcall_shared flag to the c89
or c99 command.
•
In COBOL:
°
In the Guardian environment, add a SHARED directive to the ECOBOL
command line or the source code.
°
In the OSS or PC environment, add a -Wshared flag to the c89 or c99
command, or add a SHARED directive to the source code.
•
In pTAL:
°
In the Guardian environment, add a CALL_SHARED directive to the
EPTAL command line or the source code.
°
On the PC, add a -Wcall_shared flag to the c89 or c99 command, or
add a CALL_SHARED directive to the source code.
3. Compile the source files as relinkable files, not as executable files. Do not specify
the COBOL RUNNABLE directive or the C/C++ RUNNABLE pragma.
4. Link the object files using eld with the -shared and -ul and flags. The -shared
flag directs the linker to build a DLL, and the -ul flag causes eld to link the object
files into a native user library. If the user library calls functions in another DLL, you
must specify the DLL when linking. (This is true for any DLL, not just user libraries.)
Do not link the CRTLMAIN file (in the Guardian environment) or the crtlmain.o
file (in the OSS environment and on the PC) to a user library.
The preceding steps create a DLL in two steps: a compilation step and a linker step.
Alternatively, you can create a DLL in a single step by specifying appropriate compiler
directives to invoke the linker automatically after compilation is complete.










