Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello.

I am using MVC#2010 Express to create plugins for certain software. I have lots of coding experience elsewhere but remained a bit of a noob in field of Microsoft Visual Studio projects.

Plugins are .dlls written in C# .NET 4.0., containing public class which implements interface imported from software's plugin-making dll. Each public class with interface corresponds to one custom command being added to the software.

This works fine until I want to implement a singleton class, which should be accessible by all custom commands within the plugin. Each time a command is run from the software, a new instance of singleton is created rather than using already created one, and this is preventing me from making more complex stuff, such us have a instance of anything instanced within plugin dll survive outside the scope of one command (which is the main thing I would like to accomplish).

I know this is a known problem and I read some proposed solutions, but I'm still not sure what to do.

- Establish intercomunication with dll - as much as I read this stuff depends on port being free and such, wouldn't that make problem if nature of this software the plugin is being made for doesn't exclude that more than one instance of it will be run on the same machine?

- Have a 3rd element, apart from application and plugin dll, a dll to store singleton (not sure why this would work but it was reported somewhere to be a solution). Could someone expand on that, and maybe propose a way to embed this 2nd dll into plugin dll, so that I don't need an extra dll to be distributed each time someone is using a plugin?

Also any other ideas or solutions I didn't mention would be welcome, thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900