Lazarus
Programming => Operating Systems => Android => Topic started by: roeug on October 22, 2012, 12:55:00 pm
-
How make CopyMemory, MoveMemory, ZeroMemory available in porting from Win?
-
Use the respective Pascal (platform independent ones):
- CopyMemory -> Move(<source>,<dest>,<size>);
- MoveMemory -> doesn't really exist, do you really need to?
- ZeroMemory -> FillByte(<a variable>,<the variable size>,0);
-
Use the respective Pascal (platform independent ones):
- CopyMemory -> Move(<source>,<dest>,<size>);
- MoveMemory -> doesn't really exist, do you really need to?
- ZeroMemory -> FillByte(<a variable>,<the variable size>,0);
It's the other way around. MoveMemory is the equivalent of the Pascal Move function. CopyMemory has no equivalent and is inherently unsafe, and should be replaced with Move
-
Thanks (Could find myself - was in hurry)
Another question: File routines?
In windows they were
CreateFile
GetFileSize
CreateFileMapping
MapViewOfFile
UnmapViewOfFile
CloseHandle( THandle from CreateFileMapping)
SetFilePointer
+AccessMode
Where can I find analogs in lazarus ?
TMemoryStream - ok
-
Another question: File routines?
Classic: http://www.freepascal.org/docs-html/rtl/system/filefunctions.html
Modern: http://www.freepascal.org/docs-html/rtl/sysutils/ioroutines.html
OOP: http://www.freepascal.org/docs-html/rtl/classes/tfilestream.html
-
File mapping is very platform specific. On windows you have MapViewOfFile, while on a POSIX system you can use mmap.
I don't know if anyone has made a crossplatform unit for that, but it should be possible. Otherwise you can fall back on streams