[Gambas-user] [Fwd: Gambas3 Pointers example]

Demosthenes Koptsis demosthenesk at ...626...
Sun Jan 9 20:54:25 CET 2011


This is what is said here
http://gambasdoc.org/help/howto/extern?v3
"More On Pointers"
READ #mypointer, var1_4byte
mypointer += 4
READ #mypointer, var2_4byte


i tried
Print "\nRead the pointer"
Print "Integer read:"; Integer@(pPointer)
pPointer += 4
Print "Float read:"; Float@(pPointer)

But this raises an error, "Type mismatch, wanted number get pointer instead"
Is this a bug?

As i see there is no intrinsic function of Gambas3 for moving in memory
forward or backward from a starting memory address.
Is it useful to be one? what do you say?

As i see there is only a way to move inside a memory stream with SEEK. 

On Sun, 2011-01-09 at 16:00 +0200, Jussi Lahtinen wrote:
> > Here is another question-case.
> >
> > i Alloc 12 bytes.
> > i set in memory an integer 4 bytes
> > then i set in memory a float 8 bytes.
> >
> > i can read the memory stream with READ, ok!
> >
> > How can i to this with Integer@() and Float@() functions?
> > How can i move inside memory and use Integer@() and Float@()
> >
> 
> 
> I haven't try this in gambas, but in C/C++ variables are in memory in
> straight row without any metadata.
> I assume this is also case in gambas, so;
> iFirstInteger = Integer@(pPointer)
> iNextInteger = Integer@(pPointer + 4)
> 
> 
> Jussi
> ------------------------------------------------------------------------------
> Gaining the trust of online customers is vital for the success of any company
> that requires sensitive data to be transmitted over the Web.   Learn how to 
> best implement a security strategy that keeps consumers' information secure 
> and instills the confidence they need to proceed with transactions.
> http://p.sf.net/sfu/oracle-sfdevnl 
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
Regards,
Demosthenes





More information about the User mailing list