swap arrays between your appz with PBOSL_GlobalSharedMemory
Posted: Tue Jul 12, 2005 12:44 pm
its a bit tricky, need some inlineasm (for patching the array-pointer),
but works okay for me:
but works okay for me:
Code: Select all
; Tricky, uses a inline-patch
;
; written by Siegfried Rings in 2005
;
; To test this, start it twice
;
; Remark: If you use the debugger, an array out of bounds can happen
; Solution: dim the arry big enough
Dim MyArray.f(0) ;Dim of an array
GBName.s="JoRo1"
xMax=4096
yMax=4096
Bytesize=4 ;4 bytes=1 float
GBSize=xMax*yMax * Bytesize
GBPointer=PBOSL_AllocateMemoryGlobal(GBName,GBSize)
If GBPointer
;these 2 line maps the array to global usage :)
!MOV eax,dword[v_GBPointer] ;Load Memorypointer into eax
!MOV dword [a_MyArray],eax ;copy Pointer 2 Array
;Writing
For X=0 To 9
MyArray(X)=MyArray(X)+0.5*X +0.25
Next X
;Reading
sdummy.s=""
For X=0 To 9
sdummy.s=sdummy.s+ StrF( MyArray(X)) + Chr(13)
Next X
MessageRequester("Info",sdummy,0)
PBOSL_FreeMemoryGlobal(GBPointer)
EndIf