Singleton ?
-
Hello, I want to share datas managed in a DLL that is called by 2 different applications. Someone said me sometimes a DLL with singleton can have 2 instances. An other solutions exists ? thanks Freg
When a DLL is used by a process, a "fresh copy" of it is loaded into that processes address space. The singleton instance of a class in one process is a separate entity from the singleton instance in another process. What you could do is use .NET remoting to host a singleton instance of your class. When either of your apps needs to access that truly unique instance, it would request it from the remoting service. If you need more info about remoting and singleton activation, CP has some great articles on that subject. Josh
-
Hello, I want to share datas managed in a DLL that is called by 2 different applications. Someone said me sometimes a DLL with singleton can have 2 instances. An other solutions exists ? thanks Freg
-
Then it looks like a typical IPC case. In theory, all IPC mechanisms may work for your purpose, but "shared memory" should be an effective solution for significant amount of data sharing. On Windows platform, it's implemented as "memory-mapped files" or MMF. An MMF is a kernel object that maps a disk file to certain memory block of your process address space so that multiple processes/DLLs can access the same data as if they were accesing its own process data. Google "sheared memory" or "memory-mapped file" to get yourself on the track. If you need more guidance, drop a line here. Best, Jun
-
The smallest deployment unit that exist in .NET is an assembly, but when you create an assembly (*.dll, *.exe), this makes them like small islands to comunicate them you need to use things like .NET Remoting to be able to let them talk, but the use of such power solution will make sense only if you are talking about processes(running in the back) or executable applications because either a private or public dll can be used in many applications at the same time with no problems. Hope this help