Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

FileMappingMBS.CloseFile
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Closes the file you used for backstore.
Notes: Called by the destructor automatically.

Feedback, Comments & Corrections

FileMappingMBS.CloseFileMapping
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Closes the file mapping.
Notes:
Called by the destructor automatically.
You close all views, than you close the file mapping and finally the file.

Feedback, Comments & Corrections

FileMappingMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: The dummy constructor used if you create a shared memory object.
Notes: Use this constructor if you continue with OpenSharedMemory or CreateSharedMemory.

See also:

Feedback, Comments & Corrections

FileMappingMBS.Constructor(file as folderitem, write as boolean = false)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Opens or creates a file for file mapping.
Notes:
On Windows you can pass nil for the file parameter in order to have a file mapping using the swap files for back storage.

If write is true, the file is opened/created for write access.

See also:

Feedback, Comments & Corrections

FileMappingMBS.CreateSharedMemory(name as string, Size as Int64) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Creates a shared memory object with the given name.
Notes:
Returns true on success and false on failure. The name must be unique on the whole PC.

On success, you can call MapView to access memory.
isWriteable is set to true as shared memory objects are always read and write.

Fails if the shared memory object does exist. In this case, call OpenSharedMemory.
If your application crashes, on the next run the object will still exist on Mac OS X and Linux, so you need to open or delete & create it.

The Size should be a multiply of the page size (4096).
Sets DeleteSharedMemory to true so the object is deleted by the destructor. Set it to false if you don't want that behavior.

Feedback, Comments & Corrections

FileMappingMBS.EnlargeFile(Size as Int64)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Resizes the file to the given size.
Notes: This is for file mappings used as temporary storage with a temporary file. You use the Constructor to create a temporary file. This file is enlarged to the size you need. Next you call OpenFileMapping and MapView. To cleanup, you close all views and the file mapping. Now before you close the file, you should call ShrinkFile. ShrinkFile reduces the file size to zero so the operation system doesn't start flushing the shared memory to the file. You can get this automatically if you set ShrinkFileOnClose to true.

Feedback, Comments & Corrections

FileMappingMBS.MapView(mem as MemoryBlock, offset as Int64, Size as Int32) as FileMappingViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 11.3 Yes Yes Yes Yes No
Function: Maps a portion of the file mapping or shared memory object into your application's address space.
Notes:
Returns nil on any error.
Using invalide offset/size values can lead into a bad mapping.
Here you can pass your own memoryblock for back storage.
Make sure your memory is 4 or 64 KB aligned, depending on platform.
(Windows need 64 KB, Mac only 4 KB)

See also:

Feedback, Comments & Corrections

FileMappingMBS.MapView(offset as Int64, Size as Int32) as FileMappingViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Maps a portion of the file mapping or shared memory object into your application's address space.
Notes:
Returns nil on any error.
Using invalide offset/size values can lead into a bad mapping.
(Windows need 64 KB, Mac only 4 KB)

See also:

Feedback, Comments & Corrections

FileMappingMBS.OpenFileMapping(MaxSize as Int64 = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Opens a file mapping.
Notes:
If MaxSize is zero, the file size is used for creating the mapping.
The Size should be a multiply of the page size (4096).

Returns true on success.
Do not call after using OpenSharedMemory or CreateSharedMemory as they open the file mapping for you.

Feedback, Comments & Corrections

FileMappingMBS.OpenSharedMemory(name as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Opens a shared memory object with the given name.
Notes:
Returns true on success and false on failure.

On success, you can call MapView to access memory.
isWriteable is set to true as shared memory objects are always read and write.

Fails if the shared memory object does not exist. In this case, call CreateSharedMemory.

Feedback, Comments & Corrections

FileMappingMBS.ShrinkFile
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Filemapping and Shared Memory MBS Util Plugin 10.5 Yes Yes Yes Yes No
Function: Resizes the file to by empty.
Notes: Useful if you used EnlargeFile before.

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Util Plugin.





Links
MBS Xojo Plugins