Click to See Complete Forum and Search --> : replace a dll


kokkie_d
October 22nd, 2004, 07:43 AM
Hi,

I was wondering about the following:
I have a program which uses dll's. One of those dll's I want to replace. This is not really the problem, but the program uses this dll to gather data from an interface card.
Now I want to get the data from another computer and send this via TCP/IP to the first computer. The TCP/IP programms need to be running at the same time otherwise I loose the connection.
Is it possible to use the same dll for both programs; i.e. network program writes info to the dll while the gathering program reads from the dll? Or are there better solutions (I am working on a totally different solution, but I need a temp solution for now)

Anybody some thoughts on this?

Kind regards,

dirk

NoHero
October 22nd, 2004, 07:58 AM
Hi,

I was wondering about the following:
I have a program which uses dll's. One of those dll's I want to replace. This is not really the problem, but the program uses this dll to gather data from an interface card.
Now I want to get the data from another computer and send this via TCP/IP to the first computer. The TCP/IP programms need to be running at the same time otherwise I loose the connection.
Is it possible to use the same dll for both programs; i.e. network program writes info to the dll while the gathering program reads from the dll? Or are there better solutions (I am working on a totally different solution, but I need a temp solution for now)

Anybody some thoughts on this?

Kind regards,

dirk

Yes it is possible. You should consider following things:

* You should implement a handle scheme with open and close. So programs can decide on their own if they want to read only or read/write.
* You should post each request in a queue. This avoids the problem that two programs don't bother each other.
* You should make this entire thing multi-threaded, because a program could do other things than waiting for his request to go through a queue.

Regards

kokkie_d
October 22nd, 2004, 08:55 AM
Cheers.

Is there anybody who would be able to tell me where I can find a description on how a dll acts?
I mean: if I run a program which calls a dll does it call the dll only once to start it and then just questions it when ever it needs new information or does it need to activate it everytime it needs information?

Example: My main program relies on a dll for data acquisition. The dll acts as the interface between the IO cards and the main program. Would it possible for the dll to run continuesly in the background (continuesly gathering data and making it available for the main program to read)?
Because if that is possible than I can use the same technique but run the client program (of the network) in the same way. :confused:

MrViggy
October 22nd, 2004, 11:44 AM
Just do a search in the MSDN.

DLL's are Dynamic Link Libraries. In other words, they are just libraries of code, that get dynamically loaded (when the application requests to use them). So, they actually reside in memory for the length of the application, or until the applciation tells the OS that it's done with that library.

So, to answer your question, yes. As long as the application needs the DLL, it will remain in memory. If the DLL spawns it's own threads, then yes, they will remain running.

Here's a link to get started:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_The_Advantages_of_Using_DLLs.asp

Viggy

kokkie_d
October 25th, 2004, 06:43 AM
Cheers mate,

Exactly what I was looking for.

Regards,

Dirk