Hi all, I have another question.
I hope this is an interesting topic and thanks for all the help you can give.
I have two dlls:
1 - dll_prep links against a static library, lib1. Lib1 contains a vector of objects, various classes and member functions. When the main program executes, dll_prep is loaded and its objects (defined in the static library) are correctly initialized. This lib1 is written in C++ and contains an STL vector of objects, amongst other things.
2 - dll_calc is a dll generated by compiling/linking fortran subroutines. It is called by dll_prep at runtime. dll_calc performs some calculations on objects defined in the lib1, part of dll_prep. dll_calc is linked against the lib1 static library.
dll_prep loads a function pointer in dll_calc and executes the corresponding Fortran subroutine.
dll_calc also makes some function calls into dll_prep.
The problem is that when the Fortran subroutine in dll_calc calls the functions defined in its static library lib1, it seems to be returning bogus/uninitialized memory (the vector of objects is now empty).
So to summarize:
- dll_prep depends on a static library, lib1.
- dll_calc also depends on the same static library, lib1.
I suspect that both dlls have an independent copy of the same static library, lib1 and therefore what one dll does the other doesn't know.
So my question and request for help:
when two dll are loaded and call functions (defined in a static librarY) between each other, what should I do?
I set up the project such that:
dll_prep depends on lib1
dll_calc depend on lib1 (I'm using the VS 2005 project dependencies dialog box here).
Again, thanks for the help.