Frank D. Engel, Jr. wrote:
I've considered this possibility, and I have had some issues similar to that while working with this code, but the problem I have mentioned has occurred at several different points in the program, and a bug of that nature would be showing up in other ways by now, I am quite certain. Additionally, the fix that I gave previously would indicate that the value is being correctly returned (since it is correctly assigned to the string variable), and that the procedure is correctly retrieving the value (since when using a variable, the correct data is accessed by the procedure). The problem only seems to be occurring when the name of the function is given directly in the procedure call; this may be occurring for function calls as well; I'm not sure yet. However, so far, this only seems to happen when the function returning the value has no arguments of its own, and using a temporary string to hold the value and handing the string variable to the procedure call instead of the direct result of the function call always seems to correct the problem. Note that in most of these cases, there is nothing between the assignment statement and the procedure (well, okay, there IS a semicolon...), so intervening statements should not be the cause of the problem.
Assignment to a temporary string is quite different, so it doesn't really exclude any possibility.
One thing to watch out for WRT strings is trashing the capacity field, whether in the function (the result variable) or the procedure (parameter), but that's just a wild guess. You may try, though, writing `foo.Capacity' at some points for debugging (where `foo' is `Result' or the declared result variable in the function, or the parameter name in the procedure).
I have used GPC for a number of other projects, and have not had the problems before; I have been using it most recently under MacOS X, but have also used it on Solaris and IRIX (possibly Linux at one point; I can't remember really; I know I used FreePascal under DOS and Linux), and this is the first time I am experiencing these problems... of course, this is probably the largest program I have ever written in Pascal, or in any other language, for that matter.
Unfortunately, this increases the chances for both kinds of bugs ...
The complete source tree, plus some extra files, is about 616K uncompressed; with the binaries, it bloats to over 3MB. I hesitate to send even just the source code over the list; if you have a private address you want the code on, eMail me offlist, but as I pointed out, this is largely MacOS X only right now.
You could use my private address as given in my signature, but as you say, if it only runs on MacOS X, I can't really do much with it (though maybe I'll notice something suspicious when looking at the source code). BTW, isn't it possible to separate the critical parts from the system specific code?
Perhaps Adrian or someone who is experienced with MacOS X and gdb can help trying to find out what exactly goes wrong ...
Frank