Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Singleton class for one or more process.

Status
Not open for further replies.

arunag

Programmer
Oct 3, 2001
4
DE
Hi,

If any one can suggest how to acheive this??
I have a class in a dll, i want to make this class as singleton across processes. ie., there should be one object of this class, no matter how many applications are loading this dll and using the singleton object.

Or any other design approach which will help, pls write it.

Regards,
Aruna.
 
That's going to be pretty much environment dependent and in some cases it just might not be possible without using a server type process.

-pete
 
You could try to make a service-like program of it. Call the object in the dll with the getObject function and use createObject when it fails (returns nothing). That way you should get the existing instance if there is one. I don't know if you should make an activeX exe instead of a DLL.

I never tried this, but these are my first thoughts about this problem. Hope it is of help.
 
thank you all for the response. if it is possible only with out-of-process exe i.e, as a DCOM/NT service it is fine. i can make it a DCOM singleton server and COM does the job.

if in later time u get any idea, pls write it.

regards,
Aruna.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top