(Fwd) Re: [C++-sig] Sharing Singleton instances across boost.p

Niall Douglas s_sourceforge at nedprod.com
Thu Oct 9 03:14:24 CEST 2003

Hash: SHA1

Sorry yahoo bounced this when sent off list.

- ------- Forwarded message follows -------
From:           	Niall Douglas <s_sourceforge at nedprod.com>
To:             	llywelyn.geo at yahoo.com
Subject:        	Re: [C++-sig] Sharing Singleton instances across boost.python extension	modules
Date sent:      	Thu, 09 Oct 2003 01:51:23 +0100

On 8 Oct 2003 at 16:13, Joel Gerard wrote:

> How do I share singleton instances across extension modules in
> Windows?  For instance, if I have an instance of a memory manager in
> one DLL, how do I use the same memory manager in the other?
> I realise this is a big question, but any links, references etc
> would be appreciated.  Is it even possible?

Off topic, so off list.

CreateFileMapping() and repointing the MSVC free store to use a Win32
heap (HeapAlloc()) allocated within the shared memory region.

You'll have a nightmare with data locking correctly. I recommend you
find another solution eg; use a mailslot (CreateMailslot()) to send
and receive IPC messages between the instances of code.

Usually when you come to a problem like this, it's one of design. 
Very rarely will you actually want to do what you're proposing in the 
long run. We didn't get away from global memory segments on DOS 
without a very, very good reason.  


- ------- End of forwarded message -------

Version: idw's PGP-Frontend / 9-2003 + PGP 8.0.2


More information about the Cplusplus-sig mailing list