Map routine identifiers using PRODSP()
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
You map routine identifiers to C functions in the PRODSP() dispatch routine.
ABL provides a prototype PRODSP() in the C source file,
hlprodsp.c.
hlprodsp.c file. Do not modify
this file. To make changes, copy it to a working directory and modify the copy.Because ABL calls the PRODSP() dispatch routine, it must have the following
declaration:
|
The hlprodsp.c file shows routine-identifier hlcroutine being mapped to
the C function hlcfunc() in PRODSP():
hlprodsp.c
|
For each routine you add, you must include a call to the FUNCTEST macro. For
example, to map two routine names, such as HLCROUTINE1 and
HLCROUTINE2, to two corresponding C functions, such as
hlcfunc1() and hlcfunc2(), you must include the
following lines in PRODSP():
|
CALL statement and FUNCTEST declaration
must use the same letter case for the routine identifier.Syntax
|
This is the syntax for the FUNCTEST macro in hlprodsp.c:
The routine-identifier is the name referenced by a CALL
statement that identifies your C function. Enter the routine identifier as a character
string surrounded by quotes. Since FUNCTEST does not convert case for the
routine identifier, the case is significant.
The function-name is the name of the C function that the routine-identifier references.
The routine identifier and the function name can have the same name, for example:
|
When you compile hlprodsp.c, the C compiler translates the
FUNCTEST macro references to C code, for example:
|
Translates to:
|
Therefore, when ABL invokes PRODSP() with the argument
HLCROUTINE, it runs hlcfunc.