In C, I can create a shared memory object with:
int fd = shm_open("/object", O_RDWR | O_CREAT, 0777);
I can also read this memory using mmap :
int* addr = mmap(0, sizeof(*addr), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
But how do I access this data from Haskell?
import System.Posix.SharedMem import System.IO.MMap main = do fd <- shmOpen "/bolts" (ShmOpenFlags False False False False) 0777 -- Obviously doesn't make sense, mmapFileByteString -- requires a file path that I don't have! addr <- mmapFileByteString "/bolts" Nothing print addr
source share