[Interprocess] Problem reading or wrting to shared memory

Hello, I created a simple class for storing information in shared memory (native Windows): template< class data> struct SharedData { SharedData<data>(): value(0), var(0.0), written(1), read(0){ std::cout<<" Objekt bei "<<this<<" erzeugt!"<<std::endl;} int value; // just temporary, will be replaced by a more generic data type double var; // just temporary, will be replaced by a more generic data type boost::interprocess::interprocess_semaphore written,read; }; I created and mapped that memory like: boost::interprocess::windows_shared_memory shm (create_only,name, read_write,sizeof(SharedData<data>)); boost::interprocess::mapped_region region(shm,read_write); and assigned a new data structure to it's address with: pShared = new(region.get_address()) SharedData<data>(); with pShared: SharedData<data>* pShared; But when I try to access the stored data with this pointer my program simply quits. Probably I am making a really silly mistake? Kind regards, Thomas Tel.: +49 2762 408-0 Fax.: +49 2762 408-10 Internet: http://www.camcoaudio.com CAMCO Produktions- und Vertriebs-GmbH f�r Beschallungs- und Beleuchtungsanlagen - Fischpicke 5 - 57482 Wenden - Amtsgericht Siegen HRB 7075 - Gesch�ftsf�hrer: Joachim St�cker, Reiner Sassmann, Carsten Wegner
participants (1)
-
Thomas.Schulze@camco.de