Just came across this in the online help for 10.2B, DEFINE PARAMETER statement:
Caution: For
CHARACTER
parameters, the AVM always passes the routine a pointer to the character or character string valuerather than the value itself. If the routine modifies the value, it can also modify the AVM memory outside the bounds of
the
CHARACTER
value with unpredictable results. For this reason, ABL does not allow you to useOUTPUT
orRETURN
for
CHARACTER
orLONGCHAR
parameters, as well asCHARACTER
or LONGCHAR array parameters,and does not recommend you use
INPUT-OUTPUT
forCHARACTER
orLONGCHAR
parameters.Rather, pass the character string as a
MEMPTR
parameter. For more information, see OpenEdge Development: Programming Interfaces.
Since when is it considered bad practice to use a char as an INPUT-OUTPUT parameter ?
Or am I misreading this ? [in my defence, I've only had 1 beer ...]
Julian
Isn't this specific to the GUI for .NET context? I.e., if ABL to ABL, how could it ever be outside the context of the AVM?
You read better with more beers?
Doh!
Obviously, I do read better with more beer - just reread it, and you are absolutely correct
What was I thinking ?
Don't answer that ...
Rather, pass the character string as a MEMPTR parameter. For
more information, see OpenEdge Development: Programming Interfaces.
Since it refers to the Programming Interfaces doc I guess this is for DLL or Unix Shared Libraries access.
I can't think how a .NET objects could modify the pointer and get access to memory sections it shouldn't get.