CHARACTER and LONGCHAR arrays
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
CHARACTER and LONGCHAR arrays
If the DLL requires an array of strings as INPUT which
is represented by an array of pointers to strings, you can pass
an ABL CHARACTER or LONGCHAR array.
You can do the same if it is an INPUT-OUTPUT parameter,
however, this is not recommended. If the DLL updates the
data such that the output string is longer than the input string,
this can result in a memory exception or other unpredictable behavior.
Therefore, for INPUT-OUTPUT parameters you should
use a MEMPTR array, described in MEMPTR arrays.
Also, just as you cannot pass CHARACTER or LONGCHAR OUTPUT parameters
to a DLL, you also cannot pass a CHARACTER or LONGCHAR array
as an OUTPUT parameter. If the DLL requires an
array of character buffers that it will modify or if the DLL allocates
memory for a set of strings and returns them as an array of pointers,
you should use a MEMPTR parameter.
As with the INTEGER and DECIMAL types of arrays, the data
type in the prototype can be either just the type (for example, CHARACTER) or
you can specify it with the HANDLE TO option.
Here is an example C Code Prototype for a function called nameLookup:
|
This example is the equivalent ABL for the nameLookup procedure
when accessing the function statically:
|
This example is the equivalent ABL for the nameLookup procedure
when accessing the function dynamically:
|