21.02.2013 Views

System i: Programming i5/OS PASE - IBM

System i: Programming i5/OS PASE - IBM

System i: Programming i5/OS PASE - 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.

v Argument list: The argument list must be a structure with the correct sequence of fields with types<br />

specified by entries in the signature array. You can use the size_ILEarglist() and build_ILEarglist()<br />

APIs to dynamically build the argument list based on the signature.<br />

To call ILE procedures from your <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> programs, make the following API calls in your code:<br />

1. Load the bound program into the ILE activation group that is associated with the procedure that<br />

started <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong>. You use the _ILELOADX() API to do this.<br />

This step can be unnecessary if the bound program is already active in the activation group that<br />

started <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong>. In this case, you can proceed to the _ILESYMX() step, using a value of zero for<br />

the activation mark parameter to search all symbols in all active bound programs in the current<br />

activation group.<br />

2. Find the exported symbol in the activation of the ILE bound program and return a 16-byte tagged<br />

pointer to the data or procedure for the symbol. You use the _ILESYMX() API to do this.<br />

3. Call the ILE procedure to transfer control from your <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program to the ILE procedure. You<br />

use the _ILECALL() or _ILECALLX() API to do this.<br />

Related reference<br />

“Copying header files” on page 17<br />

Use this information to copy header files from the system running <strong>i5</strong>/<strong>OS</strong> to the system running AIX.<br />

Related information<br />

size_ILEarglist()--Compute ILE Argument List Size for <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong>()<br />

build_ILEarglist()--Build an ILE Argument List for <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />

_ILELOADX()--Load an ILE Bound Program for <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />

_ILESYMX()--Find an Exported ILE Symbol for <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />

_ILECALLX()--Call an ILE Procedure for <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />

ILE Concepts PDF<br />

Examples: Calling ILE procedures:<br />

These code examples show the <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> code making a call to an ILE procedure that is part of a<br />

service program, and show the compiler commands that create the programs.<br />

There are two procedures within the following code examples. Each procedure demonstrates different<br />

ways of working with an ILE procedure, but both procedures call the same ILE procedure. The first<br />

procedure demonstrates building your data structures for the _ILECALL API using <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />

system-provided methods. The second procedure then builds the argument list manually.<br />

Note: By using the code examples, you agree to the terms of the “Code license and disclaimer<br />

information” on page 70.<br />

Example 1: <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> C code<br />

Interspersed in the following example code are comments that explain the code. Make sure to read these<br />

comments as you enter or review the example.<br />

/* Name: <strong>PASE</strong>toILE.c<br />

*<br />

* You must use compiler options -qalign=natural and -qldbl128<br />

* to force relative 16-byte alignment of type long double<br />

* (used inside type ILEpointer)<br />

*<br />

*/<br />

#include <br />

#include <br />

#include <br />

#include <br />

<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> 31

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

Saved successfully!

Ooh no, something went wrong!