Creating shared memory on Windows always fails
Hello, I'm trying to create a shared memory object using the Unreal C++ API. I am on Windows 8.1 x64. Here is my trouble code:
The FPlatformMemory::MapNamedSharedMemoryRegion always fails and in my logs I receive this message:
The GetLastError() function return value corresponds to this Windows System error code:
I don't think it's a privilege issue on my part. I am in an administrator account.
When I try to step through the MapnamedSharedMemoryRegion() function, the visual studio debugger steps through all if statements as if they don't exist.
This issue has plagued me since Unreal 4.7.
I apologize for the time since my last post, unfortunately this isn't a feature that the engine was designed to support and thus I am not quite able provide more information as to how to integrate this feature. If you believe that removing the Global prefix in the source code would fix this issue, I would suggest making a Pull Request on our GitHub page (https://github.com/EpicGames/UnrealEngine) so that it can be reviewed and possibly integrated into a future build.
Have a nice day,
answered Jul 16 '15 at 08:40 PM
Finally... a breakthrough of sorts! Here is what I did.... I changed from the default 64 bit debug game build to a 32 bit windows build. This then exposed the normal project properties I was used to seeing, rather that the very abbreviated version. I turned off all optiizations with /Od. It seems that once you have altered the default settings of project settings, you can go back to a 64 bit build, and you still can see all options.
Then I added the following includes:
include #include #include
to the beginning of my "myprojectPawn.cpp" c++ file
then in the initialization code for myprojectPawn object, I added:
define BUF_SIZE 256
//TCHAR szName = TEXT("Global\\MyFileMappingObject"); TCHAR szMsg = TEXT("Message from first process."); HANDLE hMapFile; LPCTSTR pBuf;
For the first time I'm now getting a valid pointer to the hMapFile.
I can's say that shared memory is working yet, as I need to keep working, but finally getting a valid pointer back is a big step forward.
Hope this helps...
answered Jun 26 '15 at 07:59 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here