> This code, gives error message "wanted Stream got Long instead":
> 
> pPOINTS = Alloc(4, 1522)
> tmp = CalculatePoints(pPOINTS,matrix.Data)
> 
> ....
> 
>  For ii = 0 To tmp
>  tmpPOINT = New POINT
>  Read #pPOINTS + (ii * 4), tmpPOINT.x    <---- Fails here!
>  Read #pPOINTS + (ii * 4) + 2, tmpPOINT.y
>  ...
> 
> POINT class:
> 
> Public x As Short = -1
> Public y As Short
> 
> There is also rather complicated "_compare" function, but I don't
> think it matters with this problem.
> 
> 
> This code worked fine with earlier Gambas 3 revisions.
> Does this has anything to do with my error?
>   * NEW: A Pointer can not be used as a stream directly. You must use the
>  new Memory instruction for that.
> 
> New feature understandably lacks documentation, so I need help!
> 
> Jussi
> 

Sorry, all that is work in progress.

I am currently redoing the way Gambas deals with binary data.

So now, to access memory located at a specific pointer, you must do:

Dim pPoints as Pointer
Dim hFile AS File

hFile = Memory pPoints For Read ' or For Write
...
Close #hFile

Then you use the READ instruction normally, except that hFile has an internal 
memory pointer that is automatically incremented. 

The first time, the data is read at address pPoints. But if, for example, you 
read 4 bytes, the next read will occur at address pPoints + 4. And so on until 
the end of the memory or a memory access error.

The syntax of READ and WRITE will change too, and there is an high risk that 
the bytecode format changes, and that projects need to be recompiled.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to