DLL can't map to a reloaded second DLL 
Author Message
 DLL can't map to a reloaded second DLL

Hi

MVC++ 4.2 Windows 95

We have a C DLL which is being loaded as an 'application' into a virtual
reality world using VRT from Superscape.  VRT actualy loads the Dll into
it's own VRT virtual world file, and all is fine with this.

Now, we are linking this DLL to an MFC DLL using extern "C" declexport
etc...  Thus we can run the virtual world, which loads the C DLL which can
now call functions in the MFC DLL.  We use LoadLibrary GetProcAddress for
this and it seems to work OK.  This lets us run MFC stuff from events in
the virtual world, picked up by a simple polling function in the C DLL.
What we then do, to make thing interesting, is do a LoadLibrary and
GetProcAddress from the MFC DLL to access the C DLL.  This lets us call
functions in the 'C' DLL which have access to the VRT API.  So, the net
result is a mouse click in the virtual world generates an event in the C
DLL which calls say a dialog or database view in the MFC DLL.  We then use
the 'results' of these tools to call functions in the 'C' DLL.  These are
used to manipulate the status of the virtual world.

Everything is OK here, it seems to work.

The problem comes when we try to shut the VR system down.  We had problems
getting the DAO stuff to shut down, which we then overcame using
AFXDAOTERM.
After this, the system gave up on the FreeLibrary.  So we left it up, so
Windows 95 would take it down when we closed VR.  This is OK.

Now the problem,  if we want to load a second VR world up in the same
session,  our MFC DLL is staying up, and we are creating a new instance of
the C DLL.   The C DLL makes calls to the MFC DLL using LoadLibrary, while
there is no persistent variable data in the MFC DLL, we are fairly
confident that the original MFC DLL is being referenced correctly from the
C DLL,[ because the database which was opened in it was successfully
navigated using the views which had remained open.  If the C DLL had opened
a new instance of the MFC DLL the database in the original would not be
open and those navigation events would fail and crash].  However, the
LoadLibrary back to the new instance of the C DLL is not giving the
expected results.  It seems that the MFC DLL is pointing either to what it
thinks is the old instance, or a new but different instance to that created
from VR by the new open.  The net result is that our VR world runs a new C
DLL succesfully, and calls the MFC DLL which has remained, also
successfully, but we can't get a new connection to the new C DLL from the
MFC DLL..

We need to know how to fully and safely get rid of the MFC DLL before we
load the next instance of the C DLL.  OR, we need a way to realign the MFC
DLL to look at the new C DLL.

Mike Kemp.



Wed, 22 Dec 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. !!! DLL's, Handle Maps, and Pointers

2. Message maps in extension DLL's

3. Question about using map as DLL API's parameter

4. Passing map's across dlls

5. Problem with STL Maps in Release Builds exported from DLL's

6. 2 16bit EXE's using same 16bit DLL - How does the DLL know the second EXE was started and attached to the DLL ?

7. Creating dll's referencing legacy dll's

8. point d'entrée fnovr501 d'une DLL introuvable dans C:\...\ovr501.dll

9. Mixing MFC Extension DLL's with Regular DLL's

10. VC++ DLL gets reloaded in middle of process

11. DLL not reloading under NT 4

12. importing a c++ class from a dll without linking with the dll's lib file

 

 
Powered by phpBB® Forum Software