Singleton: DLL compartida de C++

I`m creating a cast of dlls that shares a single dll.

The shared lib has a Singleton.

When running, some os loaded libs make new instances of my singleton. How can I force all libs and programs using my dll use SIEMPRE one instance of my singleton?

preguntado el 28 de agosto de 12 a las 14:08

You should probably look up the term "shared memory". -

Make it a windows service or a COM server/service -

1 Respuestas

You can't just share your singleton instance between several processes. but you can use shared memory for this purpose:

The following example demonstrates how the DLL entry-point function can use a file-mapping object to set up memory that can be shared by processes that load the DLL. The shared DLL memory persists only as long as the DLL is loaded. Applications can use the SetSharedMem and GetSharedMem functions to access the shared memory.

Respondido 28 ago 12, 14:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.