[Gambas-user] Gambas3 and Gnu scientific library
Phạm Quang Dương
soleilpqd at ...626...
Wed May 18 04:32:48 CEST 2011
Hope this help :)
The key is Pointer.
2011/4/9 Benoît Minisini <gambas at ...1...>
>
> aStruct * anExternFunc(...)
>
> with:
>
> aStruct {
>
> aClass *data
> aStruct *previous
> aStruct *next
> }
>
>
> How to get all *data
> I tried
>
> pNext = anExternFunc(...)
> while pNext <> null
>
> pData = Pointer@(pNext)
>
> ...
>
> pNext = pData + SizeOf(gb.pointer)*2
>
> wend
>
> and failed.
>
--8<--------------------------
>
> --------------------------------
>
> pStruct = anExternFunc(...)
>
> While pStruct
>
> pData = Pointer@(pStruct)
>
> ...
>
> pStruct = Pointer@(pStruct + Sizeof(gb.Pointer) * 2)
>
> Wend
>
> --8<----------------------------------------------------------
>
> That should work. Does it?
>
> You can use a memory stream and a structure too:
>
> --8<----------------------------------------------------------
>
> Struct MyDataSlot
> Data As Pointer
> Previous As Pointer
> Next As Pointer
> End Struct
>
> ...
>
> Dim hMem As Stream
> Dim hSlot As MyDataSlot
>
> pStruct = anExternFunc(...)
>
> While pStruct
>
> hMem = Memory pStruct For Read
>
> hSlot = Read #hMem As MyDataSlot
>
> pData = hSlot.Data
>
> ...
>
> pStruct = Pointer@(hSlot.Next)
>
> Wend
>
> --8<----------------------------------------------------------
>
> Regards,
>
> --
> Benoît Minisini
>
More information about the User
mailing list