2

I have an executable that looks for a particular DLL. I have changed the source for DLL and recompiled it (written and recompiled in VB6). Once I replace the DLL, the executable hits a runtime error when it gets to using that particular DLL. Works ok when I recompile the executable.

So my question is, with same DLL path, same name, and virtually identical DLLs, why does the executable need to be recompiled?

This is driving me bananas so any thoughts would be appreciated. Thanks, Callum.

Callum
  • 23
  • 3
  • 5
    A DLL has unique IDs for itself and its public interfaces, if you recompile these can change and any existing code bound to the old IDs fails. Tldr; Tick "Binary Compatibility" in the DLL's project options & select the old working DLL as the thing to maintain compatibility with & recompile. Detailed explanation: https://www.techrepublic.com/article/demystifying-version-compatibility-settings-in-visual-basic/ – Alex K. Feb 24 '22 at 13:05
  • 1
    It's been nicknamed "DLL Hell". A web search on that term will bring you links like Alex posted. This was a major reason why .NET was developed. to help remove some of these problems. https://stackoverflow.com/questions/1379287/i-keep-hearing-about-dll-hell-what-is-this – User51 Feb 24 '22 at 14:13
  • Alex you are wonderful. That was exactly the reason. And yes User51 DLL Hell was exactly what I have been in for the last two weeks. The problems with running 20 year old programs with 40 year old equipment, in a 15 year old OS.... Alex, if you copy and paste your comment into an answer, I can mark it as answered :) – Callum Feb 24 '22 at 15:10
  • Does this answer your question? [Determining why binary compatibility is broken](https://stackoverflow.com/questions/15771401/determining-why-binary-compatibility-is-broken) – StayOnTarget Feb 28 '22 at 18:52

1 Answers1

2

A VB6 (or any COM) DLL has unique IDs for itself and its public interfaces, if you recompile these can change and any existing code bound to the old IDs fails.

Tldr; Tick "Binary Compatibility" in the DLL's project options & select the old working DLL as the thing to maintain compatibility with & recompile.

Detailed explanation: I keep hearing about DLL hell - what is this?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Alex K.
  • 171,639
  • 30
  • 264
  • 288