[Done] #PB_Structure_AlignC in Linux x86
Posted: Fri Sep 19, 2025 5:35 pm
In Linux x86 function ResetStructure() overwrites data from other variables/structures if the structures are declared with #PB_Structure_AlignC.
Tested in C backend Linux x86.
Tested in C backend Linux x86.
Code: Select all
Macro ma_bool32 : l : EndMacro
Macro ma_uint32 : l : EndMacro
Macro ma_uint64 : q : EndMacro
Structure ma_data_source_base Align #PB_Structure_AlignC
*ma_data_source_vtable
rangeBegInFrames.ma_uint64
rangeEndInFrames.ma_uint64; /* Set to -1 for unranged (default). */
loopBegInFrames.ma_uint64 ; /* Relative to rangeBegInFrames. */
loopEndInFrames.ma_uint64 ; /* Relative to rangeBegInFrames. Set to -1 for the end of the range. */
*pCurrent ; /* When non-NULL, the data source being initialized will act as a proxy and will route all operations to pCurrent. Used in conjunction with pNext/onGetNext for seamless chaining. */
*pNext ; /* When set to NULL, onGetNext will be used. */
*onGetNext ; /* Will be used when pNext is NULL. If both are NULL, no next will be used. */
islooping.ma_bool32
EndStructure
Structure ma_pcm_rb Align #PB_Structure_AlignC
ds.ma_data_source_base
channels.ma_uint32
sampleRate.ma_uint32
EndStructure
Structure ma_duplex_rb Align #PB_Structure_AlignC
rb.ma_pcm_rb
EndStructure
Structure ma_device Align #PB_Structure_AlignC
duplexRB.ma_duplex_rb
EndStructure
Structure sTest
val.u
Name.s
EndStructure
Structure sList
Index.u
List rList.sTest()
EndStructure
Global s1.ma_device, s2.sList
For i=1 To 10
If AddElement(s2\rList())
s2\rList()\Val = i
EndIf
Next
Debug ListSize(s2\rList())
ResetStructure(@s1, ma_device)
Debug ListSize(s2\rList()) ; The result should be 10
ShowMemoryViewer(@s2, SizeOf(sList))