[Gambas-user] How to import and/or use Linux function "memcopy"?

Carl Nilsson nilsson at ...1979...
Sat Jan 25 15:12:54 CET 2014


Good evening Benoit:
Actually, it is the C function memmove that I 
want to use.  I will be using it all the time to 
shuffle array elements along, like a shift 
register in data filtering.  The Windows function 
CopyMemory  is very fast and much more efficient 
than using do loops in VB6.  It is also very 
useful in handling serial input byte data which 
comes in varying size packets.  I have been using 
the Win kernel CopyMemory for years in VB6 
without problems and I wish to implement similar 
functionality in the port to Gambas.  This 
evening I have got as far as being able to run 
memmove in Gambas, but not yet correctly.  I'm 
still struggling a bit with pointers.  It seems I 
cannot use VarPtr on a (1-D) integer array at a 
particular element number of a linear, say, 
integer array like VarPtr(iArray[18]).  So I have 
got as far as trying iPtr = VarPtr(iArray) +  72 
(for that example) without success.  I have 
assumed my iPtr (declared as a Pointer) is an 
integer value that increases by 4 for each 
integer element, but I could be off the 
track.  Being "dangerous" does not unduly concern 
me - my computer won't blow up! I just need to 
move blocks of data back and forth quickly!
Carl


At 12:42 AM 26/01/2014, you wrote:
>Le 25/01/2014 08:23, Carl Nilsson a écrit :
> > G'day all:
> > Linux has "memmove" and Windows has "MoveMemory".  How do I import or
> > reference memcopy into Gambas?  I can see that I should be able to
> > effect this function using stream Memory Read and Write, but it may
> > not work as fast?  I need to use this many times
> > Carl.
> >
>
>Why do you need to copy memory? You should not, it's dangerous.
>
>--
>Benoît Minisini
>
>------------------------------------------------------------------------------
>CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>Learn Why More Businesses Are Choosing CenturyLink Cloud For
>Critical Workloads, Development Environments & Everything In Between.
>Get a Quote or Start a Free Trial Today.
>http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user

Carl S Nilsson
137 Gordons Hill Road
Lindisfarne, Tas.
Australia 7015 


More information about the User mailing list