I use this extensively in my code, has anyone made a copymemory replacement in Gambas?
I assume it will require an opem .. then a read and write
thanks
vb6 CopyMemory replacement
- BruceSteers
- Posts: 1569
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: vb6 CopyMemory replacement
you may need to wrap your head around the fact that despite gambas being similar to vb it really is not vb and it works quite differently.
what exactly does copymemory do? (except of course what it obviously sounds like) it's not a function i think i have ever needed in gambas so my guess is we do it differently.
Most likely the gambas alternative is simpler than vb requirements.
If you can post some example code it might help.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: vb6 CopyMemory replacement
hello,
I definitely see how Gambas does things very elegantly, and I do understand they are different...
here is how its used, its a windows call that copies raw bytes in memory from one location to another
CopyMemory byBuffer(0), array, Len(array)
https://learn.microsoft.com/en-us/previ ... 5(v=vs.85)
I definitely see how Gambas does things very elegantly, and I do understand they are different...
here is how its used, its a windows call that copies raw bytes in memory from one location to another
CopyMemory byBuffer(0), array, Len(array)
https://learn.microsoft.com/en-us/previ ... 5(v=vs.85)
Re: vb6 CopyMemory replacement
From what I see, the VB6 function "CopyMemory()" is basically analogous to C language function "memcpy()".
Indeed this C function copies n characters from source memory area to destination memory area:
https://www.tutorialspoint.com/c_standa ... memcpy.htm
Therefore, if you want to emulate VB6 "CopyMemory()" function in Gambas, you have - in my opinion - at least two possibilities, adopting the solutions proposed in these pages of Gambas Italian forum Wiki:
1) call the external C function "memcpy()" directly with the keyword "Extern".
https://www.gambas-it.org/wiki/index.php/Memcpy_()
2) emulate the "memcpy()" function of C by using Gambas resources:
https://www.gambas-it.org/wiki/index.ph ... cpy()_di_C
Indeed this C function copies n characters from source memory area to destination memory area:
https://www.tutorialspoint.com/c_standa ... memcpy.htm
Therefore, if you want to emulate VB6 "CopyMemory()" function in Gambas, you have - in my opinion - at least two possibilities, adopting the solutions proposed in these pages of Gambas Italian forum Wiki:
1) call the external C function "memcpy()" directly with the keyword "Extern".
https://www.gambas-it.org/wiki/index.php/Memcpy_()
2) emulate the "memcpy()" function of C by using Gambas resources:
https://www.gambas-it.org/wiki/index.ph ... cpy()_di_C
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
Re: vb6 CopyMemory replacement
Thank you vuott!