Hi, I use the following code to indirectly be able to pass a structure as a ProcedureReturn:
Structure MYSTRUC
x.f
y.f
EndStructure
Procedure.l Something()
*out.mystruc=AllocateMemory(SizeOf(mystruc))
*out\x=0.5
*out\y=1.25
ProcedureReturn *out
EndProcedure
CopyMemory(something(),test.mystruc,SizeOf(mystruc))
Debug test\x
Debug test\y
I'm wondering, if the allocated memory will be discarded by PureBasic (since it is now linked with 'test'), or if I have to do a "FreeMemory()".
MemoryAllocation
This is more apropiate:
Manolo
Code: Select all
Structure MYSTRUC
x.f
y.f
EndStructure
Procedure.l Something(*MYSTRUC.mystruc)
*mystruc\x=0.5
*mystruc\y=1.25
ProcedureReturn
EndProcedure
Something(@test.MYSTRUC)
Debug test\x
Debug test\y
Return to the forum
