02-03-2026, 12:05 AM
This is probably a job for Unseen, but if anyone else has followed his QB_Universal work, here is one I don't get what's going on...
https://qb64phoenix.com/forum/showthread...7#pid39637
THE SECOND CODE BOX.
If you want to test it, remember to go to the first post to download the small lib and header file.
What's weird is that the code in the function should produce two parent strings in the output, Fruit123 and Meat. Instead, it produces Fruit123 and Meatt123. Note the extra t. Interesting that both are at different memory addresses, but I have a hunch, unless I goofed up something, the Var_SetString library function is somehow writing the second string over the longer first string, and then putting that Meatt123 into memory. Now if you run the third code box, where I simply moved the guts of the function (unchanged) into the main, the darn thing works. Why it fails to work properly if in the functions is not apparent to me at this time. Maybe a bug, or me being buggy.
It doesn't seem to matter if the variables are passed or changed to global. It does give some even weirder results if we put anotehr string variable in the function where we change...
a = Var_New: Var_SetString a, Parent: Var_Push MemSystem, a: Parent_Node = a
to...
q$ = Parent: Var_SetString a, q$: Var_Push MemSystem, a: Parent_Node = a
That outputs:
MeatFruit123
Weird. It combines them with this variable substitution, but overwrites the first characters of the fruit string when left in the original form. That's why I suspect this is the problem, and possibly a bug or maybe there is a way to clear the Var_SetString function.
BTW - Everything works fine with "Child" subroutine.
Any thoughts, or should we wait for John on this one?
Pete
https://qb64phoenix.com/forum/showthread...7#pid39637
THE SECOND CODE BOX.
If you want to test it, remember to go to the first post to download the small lib and header file.
What's weird is that the code in the function should produce two parent strings in the output, Fruit123 and Meat. Instead, it produces Fruit123 and Meatt123. Note the extra t. Interesting that both are at different memory addresses, but I have a hunch, unless I goofed up something, the Var_SetString library function is somehow writing the second string over the longer first string, and then putting that Meatt123 into memory. Now if you run the third code box, where I simply moved the guts of the function (unchanged) into the main, the darn thing works. Why it fails to work properly if in the functions is not apparent to me at this time. Maybe a bug, or me being buggy.
It doesn't seem to matter if the variables are passed or changed to global. It does give some even weirder results if we put anotehr string variable in the function where we change...
a = Var_New: Var_SetString a, Parent: Var_Push MemSystem, a: Parent_Node = a
to...
q$ = Parent: Var_SetString a, q$: Var_Push MemSystem, a: Parent_Node = a
That outputs:
MeatFruit123
Weird. It combines them with this variable substitution, but overwrites the first characters of the fruit string when left in the original form. That's why I suspect this is the problem, and possibly a bug or maybe there is a way to clear the Var_SetString function.
BTW - Everything works fine with "Child" subroutine.
Any thoughts, or should we wait for John on this one?
Pete

