RE: how to share a static variable between 2 different process
- From: Ciaran O''Donnell <CiaranODonnell@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Jul 2008 03:41:01 -0700
Yes, it appears I did. Sorry about that.
Here it is:
http://my.execpc.com/~gopalan/dotnet/complus/complus.net_accountmanager.html
It might not be exactly what your after but it look like a good starter for 10
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Riccardo" wrote:
Sorry, maybe you forgot the link to the page..
Thanks.
"Ciaran O''Donnell" wrote:
Ok, so thats a little different. If you are using COM then you can load the
dll into Component Services in Windows as a COM+ server. There are various
tutorials on the web that will talk you through registering the server and
generating a type library (tlb) file to add as a reference to your client
code.
Architecturally it would be nicer to move away from COM and setup a WCF
service to host the server and have that access a SQL Server (SQLEXPRESS is
free) database but if you really cant change that then dont worry about it.
Here is a page which gives a walkthrough of building a COM+ server
application which is implemented in .NET
Hope this helps
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Riccardo" wrote:
This is not a good news for me :-)
I'll try to explain better: my dll has been exposed as a COM object thanks
to interop. All the clients could call some methods like ListAvailableSeats,
ReserveSeat, PaySeat, etc. The dll has a full control on the access db where
available seats are stored. The db just has 2 fields: Id, Description. I
cannot change its structure.
The multiple COM clients could be located on different machines, require the
list of the available seats, reserve one of them and pay the reserved one. Of
course one client could pay only seats who reserved itself.
The only operation that the dll could do on the db (except reading it) is to
remove the appropriate record whenever the seat is paid.
What I would like to do is keeping trace (possibly only in memory, not on
disk) of the reservations and the related process who made the reservations.
Thanks.
Riccardo Mingozzi
"Ciaran O''Donnell" wrote:
This is not possible with normall coding in .NET. You would need to setup
interprocess communication in a client server type way.
Remoting or WCF would be the best mechanisms for establishing but you would
need to work out which process should hold the master copy and then create a
service in it for the other processes to access it. You could potentially
propogate changes around with events/callbacks over the communication channel.
The other option is to hold the values in a database, or the registry or
some other centralised storage mechanism.
If you give a bit more information on the requirement we might be able to
help you choose the best way to do it.
HTH
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Riccardo" wrote:
Hi everybody,
I have a c# dll and I want to call the class library from several
applications.
I need some variables to be static in the memory space, not locally to each
process.
Thus, if application A modifies the variable X of a class contained in the
dll, application B should be able to see the changed value.
Does anybody has any idea of how to obtain this?
Thanks in advance.
Riccardo
- References:
- RE: how to share a static variable between 2 different process
- From: Ciaran O''Donnell
- RE: how to share a static variable between 2 different process
- From: Riccardo
- RE: how to share a static variable between 2 different process
- From: Ciaran O''Donnell
- RE: how to share a static variable between 2 different process
- From: Riccardo
- RE: how to share a static variable between 2 different process
- Prev by Date: RE: how to share a static variable between 2 different process
- Next by Date: RE: Read INIFile from String or Stream
- Previous by thread: RE: how to share a static variable between 2 different process
- Next by thread: Re: converting a filename to a unc filename
- Index(es):
Relevant Pages
|