vb6 CopyMemory replacement
Posted
#1
(In Topic #1026)
Trainee
I assume it will require an opem .. then a read and write
thanks
Posted
Guru

axisdj said
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
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.
Posted
Trainee
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/previous-versions/windows/desktop/legacy/aa366535(v=vs.85)
Posted
Regular

Indeed this C function copies n characters from source memory area to destination memory area:
C library - memcpy() function
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:
<COLOR color="#BF0000">1</COLOR>) call the external C function "memcpy()" directly with the keyword "Extern".
https://www.gambas-it.org/wiki/index.php/Memcpy_()
<COLOR color="#BF0000">2</COLOR>) emulate the "memcpy()" function of C by using Gambas resources:
https://www.gambas-it.org/wiki/index.php/Emulare_in_Gambas_la_funzione_memcpy()_di_C
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Trainee
1 guest and 0 members have just viewed this.


