From: ranjan sri Date: 2010-02-10T16:10:46+09:00 Subject: Shared memory creation in ruby Hi, I am new to ruby and I want to write code which makes shared memory and writes to it.Similar to the C code here: void main(int argc, char* argv[]) { HANDLE mappedFile = 0; int oneSecond = 1000; char* shared = NULL; HANDLE eventHnd; eventHnd = CreateEvent(NULL, FALSE, FALSE, "TestSharedEvent"); // STEP 1 mappedFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, "TestSharedMemory"); printf("CreateFileMapping returned %d\n", mappedFile); fflush(NULL); // STEP 2 shared = (char*)MapViewOfFile(mappedFile, FILE_MAP_WRITE, 0, 0, 0); printf("MapViewOfFile returned %p\n", shared); fflush(NULL); memset(shared, 0, 4096); printf("memset worked\n"); fflush(NULL); int counter = 0; while (1) { sprintf(shared, "value %d", counter++); printf("Sending new string: %s\n", shared); SetEvent(eventHnd); // STEP 5 //Sleep(1000); } UnmapViewOfFile(shared); } Please suggest .Thanks in advance. -- Posted via http://www.ruby-forum.com/.