ProcedureDLL AttachProcess(instance)
Global Dim Array.s(5)
EndProcedure
ProcedureDLL CreateArray()
For i = 1 To 5
Array(i) = "Line " + Str(i)
Next
ProcedureReturn @Array(1)
EndProcedure
Dim Array.s(5)
If OpenLibrary(0, "dll_test.dll")
ArrayAdress.l = CallFunction(0, "CreateArray")
Array(1) = PeekS(ArrayAdress)
For i = 1 To 5
Debug Array(i)
Next
CloseLibrary(0)
EndIf
Why the result return only the first line of the array :roll:
Thank you very much for your help
Last edited by Kwai chang caine on Thu Jun 21, 2007 9:45 am, edited 1 time in total.
ProcedureDLL AttachProcess(instance)
Global Dim Array.s(5)
EndProcedure
ProcedureDLL.l CreateArray()
For i=1 To 5
Array(i)="Line "+Str(i)
Next
ProcedureReturn @Array()
EndProcedure
Dim Array.s(5)
If OpenLibrary(0,"dll_test.dll")
*ArrayAdress.l=CallFunction(0,"CreateArray")
Array()=*ArrayAdress
For i=1 To 5
MessageRequester("hi",Array(i))
Next
CloseLibrary(0)
EndIf
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Flype wrote:'Static Dim' allow such manipulations.
Global Dim = Static Dim.
But each PB array is 8 bytes, the example above sets only 4 bytes, so something is bound to go wrong sometime unless someone knows exactly how PB's arrays are implemented.
Flype wrote:'Static Dim' allow such manipulations.
Global Dim = Static Dim.
But each PB array is 8 bytes, the example above sets only 4 bytes, so something is bound to go wrong sometime unless someone knows exactly how PB's arrays are implemented.
Trond wrote:It has a memory leak...
please trond, can you explain a bit more, i really don't understand the problem.
if so, what's the problem and how to do what Kwaï chang caïne requested ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
;DLL:
ProcedureDLL AttachProcess(instance)
Global Dim Array.s(5)
EndProcedure
ProcedureDLL.l CreateArray()
For i=0 To 5
Array(i)="Line "+Str(i)
Next
ProcedureReturn @Array()
EndProcedure
;EXE:
Structure array
item.s[0]
EndStructure
If OpenLibrary(0,"dll_test.dll")
*var.array=CallFunction(0,"CreateArray")
For i=0 To 5
MessageRequester("hi",*var.array\item[i])
Next
CloseLibrary(0)
EndIf