Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Best way to make a single object instance public to other processes ?

Posted on 2016-09-16
7
Medium Priority
?
56 Views
Last Modified: 2016-10-09
Hello Everyone,

I would like to ask you what is the best way to make a single object instance public to other processes ?  
As COM server exe is not directly foreseen is WCF still the right candidate ?

What do you think ?
Thank you very much in advance
Best regards.
MiQi.
0
Comment
Question by:festijazz
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 10

Expert Comment

by:Prakash Samariya
ID: 41801427
You might looking for Singleton Pattern which allow only one instance!
Please check below link
Implementing the Singleton Pattern in C#
0
 
LVL 1

Author Comment

by:festijazz
ID: 41801438
Hello Sir,
Thank you for your reply but I do not see how I will be able to inter link two process via the solution you propose.

A process needs to access an object defined and instantiated in another process.

What do you think ?
 Thank you very much in advance
 Best regards.
 MiQi.
0
 
LVL 10

Expert Comment

by:Prakash Samariya
ID: 41801682
Can you describe your need?
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 29

Expert Comment

by:pepr
ID: 41803049
Actually, a process is isolated from other processes by definition. The only way to share the information is through the data transfer.

In other words, the shared information is or a persistent data structure (information from the stared database, shared file, etc.), or the active object is encapsulated in the dedicated (another) process, and you use some communication protocol to ask for the info and get the information back.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 41805227
you may use named shared memory for your purpose, if the object is a data structure. either process could map to the shared memory by name. the first process would copy the shared data to the memory (with or without parameters to control access or synchronisation). either process could have a pointer to the shared instance.

if the object also is code, you could manage it in a service and provide data + functions.

Sara
0
 
LVL 1

Accepted Solution

by:
festijazz earned 2000 total points (awarded by participants)
ID: 41805522
Hello everyone,
thank you for all inputs but I have found the solution by googling on the web.
The solution I need to use is .NET remoting.
I can post you an example if needed.

Best regards.
MiQi
0
 
LVL 35

Expert Comment

by:sarabande
ID: 41835694
The Asker told us that they found a solution by using the .NET Framework.

I don't think that any of the other comments could be called a solution or assist.

Sara
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question