The mysql.functions.i program (attached) seems to work fine in OpenEdge 10.1b and OpenEdge 10.2.
I face a problem when I try to run the program in OpenEdge 11.2. The memptr are passed into the procedures, but when they comes back from the procedure I can no longer change the set-size of the memptr.
Obviously this causes me issues with me not being able to set the memptr back to 0 and _progres.exe crashes with the following problem signature.
Problem Event Name: APPCRASH
Application Name: _progres.exe
Application Version: 22.214.171.1246
Application Timestamp: 511c2f10
Fault Module Name: StackHash_a4e0
Fault Module Version: 6.1.7601.18798
Fault Module Timestamp: 5507b3e0
Exception Code: c0000374
Exception Offset: 000cea0b
OS Version: 6.1.7601.2.1.0.272.7
Locale ID: 2057
Additional Information 1: a4e0
Additional Information 2: a4e093e2bd923dcbc51e9525914f25b6
Additional Information 3: 05b3
Additional Information 4: 05b3835b1742b4994b276f96d470be2b
Does anyone have any ideas?
Just a few comments. I think you will need to rework some of that logic. I did a quick search on mysql_close() and its documentation describes that the function will deallocate the memory (which was gotten vai mysql_init()). So you cannot be calling SET-SIZE() on it to set it to 0 as the memory has already been deallocated. This may seem to work but the behavior is undefined when you do that and it may crash the session.
The other one that caught my attention was the call to mysql_real_connect() - The code is calling SET-SIZE(0) on the return value, but the documentation on it says that the returned value is the same as the first parameter, so it doesn't look right to me that the code is setting the size to 0 in that case either.