hi Duoas,
thanx for the reply.
the thing is, i don't need to share objects across processes, just between shared libraries in the same process.
as far as linkage is concerned, apart from its exports each library is a world in itself, however it is quite valid for a shared library to access data in main() if it is provided with a suitable reference.
the situation i'm trying to manage is where objects are created dynamically in a shared library, but persist for longer than the lifetime of the library.
i'm fairly sure this is valid c++, and i'm fairly sure it works ok with windows dll's. i've even seen architectures that use 'hot swappable' classes, wherein new implimentations of classes can be installed while the old ones are still in use in memory (provided the interfaces are constant).
the problem i have is that i suspect there are some gotchas with deletion of these objects. i'm using boost::shared_ptr, which is reference counted, so deletion is automatic, so i need to get this right.
i have been tempted to use mmap actually... btw, do you know if there is a Linux analog to the windows #pragma data_seg(".shared_stuff") mechanism? it is a great alternative to memory mapped files in windows. [
http://msdn.microsoft.com/en-us/library/h90dkhs0(VS.80).aspx]
i'd prefer to use default memory allocation tho, if possible as my program is quite complex and uses -=many=- small objects.
any ideas?
cheers
Jono