|
From: AliReza K. M. <kho...@gm...> - 2009-04-12 00:52:41
|
Dear All, I had two questions regarding shared memory: 1)Can I use POSIX shared memory in MinGW? As I saw MinGW doesnot provide me with sys/mman.h header file which is used by shm_open(), and shm_unlink(). So, is there any way to use POSIX shared memory with MinGW. ------------------------------------------ I also had a previous question about Windows shared memory. I am trying to share some file between two codes, one compiled in MSVC++, and another in MinGW, here is my complete files, and explanations. I was assuming I should be able to share data between the two using Windows Shared Memory, but seems that I cannot. Let's say, I have written some handy functions to work with shared memory in a separate .c, .h file, here is the simplified version (without any error checking to make it simple)(MCCLSharedMemory.c) http://pastebin.com/f199af577 Then I have two programs to read and write from/to shared memory, here is the one that writes to shared memory (Wrtier.c): http://pastebin.com/d36de5761 And here is the one that reads from the shared memory: http://pastebin.com/d46dbfe37 I run the programs simultaneously. Writer.c is compiled under MSVC++, and as you see after running, it blocks because of "_getch()" untill I enter a character. Reader.c is run under MinGW. It's expected that the string written in MSVC++ to be viewed in MinGW, but I cannot see the text in MinGW. Thanks, Alireza |