C# Equivalent code in delphi for memory mapped files -
i got code 1 of vendor read memory mapped file in c#, due limitations need develop code in delphi-7 language. code got written below.
the tool reading analog input hardware module.
can 1 me find equivalent code of c# in delphi? c# code below-
memorymappedfile file = memorymappedfile.openexisting("my_shared_location"); memorymappedviewaccessor reader = file.createviewaccessor(); (int = 0; < 16; i++) { inputbyte[i + 1] = reader.readbyte(i); }
i found equivalent class of memorymappedfile still unable code rest of part in delphi-7.
memory mapped files feature provided windows different processes share memory.
i don't have access delphi compiler test this, should set on right path. i'm making assumptions based on code sample provided: intend reading data, you'll read 16 bytes. if these invalid, you'll have changed code accordingly.
hfile := openfilemapping(file_map_read, false, "my_shared_location"); win32check(hfile); try //buffer must byte pointer buf := mapviewoffile(hfile, file_map_read, 0, 0, 16); win32check(buf); try //use buf^ please unmapviewoffile(buf); end; closehandle(hfile); end;
for more info on various memory map api routines, see following:
https://msdn.microsoft.com/en-au/library/ms810613.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366556(v=vs.85).aspx
Comments
Post a Comment