How to detect multiple lib versions?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi all,

I have authored several native DLLs (call them A, B, and C). These libraries have references between each other (A calls B which calls C). These libraries are built and made available to callers both in "debug" and "release" versions. The release versions of the libraries are A, B, and C (.lib and .dll), while the debug versions are A_debug, B_debug, and C_debug (.lib and .dll).

Now, because these libraries maintain internal state and call into each other, ugly things happen if a caller links with the release version of one library and the debug version of another library. At run-time, this causes both versions of some of the libraries to be simultaneously loaded. (For example, if the user calls into the debug version of A, which calls into the debug version of B, and then the user explicitly calls into the release version of B, then both B and B_debug would be simultaneously loaded, each with its own internal state.)

So, how can I detect when a program references the debug version of one of my libraries and the release version of another library? Ideally, I'd like to put some magic into the source code that causes a linker error. Alternatively, I guess I could have DLL initialization code that somehow detects when more than one instance of the DLL have been loaded.

TIA - Bob

.



Relevant Pages

  • Re: How to get imagebase after a DLL gets loaded
    ... The main difference between DLL and static library in this context is ... so that it is not meant to be integrated with the client code ... SPEAKING ABOUT STATIC LIBRARIES HERE, AND I *EXPLICITLY* SAID IT THIS ...
    (microsoft.public.win32.programmer.kernel)
  • Re: C run-time library
    ... >Debug Single-Threaded ... >Debug Multithreaded DLL ... to provide a comprehensive selection of libraries, ...
    (microsoft.public.vc.language)
  • Re: How to get a .lib from .dll
    ... Using the Borland tools, you should first run "IMPDEF" on the DLL file ... information in it to create ".LIB" import libraries with;)... ... from Windows version to Windows version...so, ...
    (comp.lang.asm.x86)
  • Re: How to get a .lib from .dll
    ... Using the Borland tools, you should first run "IMPDEF" on the DLL file ... information in it to create ".LIB" import libraries with;)... ... from Windows version to Windows version...so, ...
    (alt.lang.asm)
  • Re: Dll issue
    ... > I have a big problem with a owned dll. ... > indetermined period, but if I register the new library.dll, the old app ... provide a way to dynamically set references. ... Extensibility libraries for Access 2000, VB5, and VB6 all have a References ...
    (microsoft.public.vb.controls)