(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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry yahoo bounced this when sent off list.

Niall
- ------- 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.  

Cheers,
Niall

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




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

iQA/AwUBP4S2cMEcvDLFGKbPEQKh9wCgvg2h3icoJXZYW2fShQpR9ZK5U64AoOfs
zk8Xcn5Xjf7q6BRMxYFvrj+W
=Q/Ut
-----END PGP SIGNATURE-----




More information about the Cplusplus-sig mailing list