Click to See Complete Forum and Search --> : Sharing data between dll and exe


CCC
December 14th, 2004, 01:15 AM
Hi


I am working in vc++. I have a library(dll) and a Test application(.exe) which uses this .lib file. I have a function(Thread function) in the dll which has to insert data into a circular linked list . This linked list should be accessible in the test application, and the test application should simultaneously be able to take the inserted data in the dll from the linked list and display in list ctrl.
The linked list should be used as a global interface between the test application and the library. As such, both modules should have a pointer to this linked list.

How can I do this? Can anyone please guide me? I never worked with this kind of application.

Thanks in anticipation of information.
Madhavi.

Andreas Masur
December 14th, 2004, 03:03 AM
Welll....basically there is nothing special if you make sure that the memory for the list gets managed by either the dll or the application completely...in other words, since the list should be provided by the dll, make sure that the dll is responsible for adding, deleting elements to the list.

This would be the easiest solution...more difficult methods would be using shared memory for the list object...

kuphryn
December 14th, 2004, 10:15 AM
Given that the sharing is between the DLL and one executable, then there are several solutions. The simpliest solution is a global variable.

Kuphryn

tangjun
January 10th, 2005, 05:00 PM
I have the same question but the problem is bigger. What I want to share between the executable and the dll is a large amount of data, as well as functions to manupulate the data.

Global variables obviously don't work in this situation, shared memory can share some data, but what about the functions?

kuphryn
January 10th, 2005, 09:42 PM
In this case, the function can reside in either of those modules.

Kuphryn