PlanetSquires Forums

Support Forums => WinFBX - Windows Framework for FreeBASIC => Topic started by: Paul Squires on March 18, 2023, 06:53:42 PM

Title: CMemMapFile class
Post by: Paul Squires on March 18, 2023, 06:53:42 PM
Just wanted to pass along my gratitude for this wonderful CMemMapFile class. Thanks José !

I have a need to share data between a C++ created exe and an FB created exe.

I first used the physical file memory mapped approach. Worked perfectly once I realized that the disk file must first exist and be of the buffer size that you require.

I then tried bypassing the disk file and just use shared memory between the two EXE's. The EXE that first creates the shared memory block must use the class's MapMemory method. The second EXE that attaches itself to this new shared memory must use the class's MapSharedMemory method. Both method calls must share the same mapping name, line "SHARED-MEMORY" or something that uniquely identifies the block of memory so that both EXE's know what memory to attach themselves to. Worked perfectly, once I figured that out.

Thanks again, and if anyone in the future stumbles on this post when searching for file CreateFileMapping, MapViewOfFile, or UnmapViewOfFile then you may save yourself a bit of time by remembering my couple of tips. Also look at José's documentation which (stupid me) I forgot to check out first before diving into the class and trying to learn it by studying the source code. https://github.com/JoseRoca/WinFBX/blob/master/docs/File%20Management/CMemMapFile%20Class.md

 ;D