0

Suppose I have an addin dll (Addin.dll) for application App.exe that links with Static Library Foo.lib.

Foo.lib is created while building application App.exe. App.exe has multiple minor releases say App.exe (Version 1.0), App.exe (Version 1.1),etc.

My Addin.dll (Version 1.0) links with the base version of Foo.lib ( Version 1.0, corresponding to App.exe (Version 1.0)).

Is it safe to use my Addin.dll (Version 1.0) with higher version of App.exe (Version 1.8)?

Conversely, if I build my Addin.dll (version 1.8) by linking with higher version of static library Foo.lib (Version 1.8, corresponding to App.exe (Version 1.8)), is it safer to use Addin.dll (version 1.8) with lower version application App.exe (Version 1.0)?

What are the issues I am likely to face in both the approaches?

Assume that the compiler version is same for all the minor version of App.exe.

Thanks in Advance!

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • There is no clear "yes" or "no" answer to this question, as it depends on the project and how it adds, removes or modifies its API exported in the library. – Some programmer dude Nov 28 '17 at 07:35
  • Static linking means adding the actual code from the library to the output ... you will have your static lib twice, the older version as part of the DLL, the newer one as part of the application. Whether this is unsafe or not depends on the actual changes in the static lib. –  Nov 28 '17 at 07:37
  • What you describe sounds like a plugin interface. This should really be done either using a shared library (dll) or by having your plugin call code in the app itself (on windows, create an *import library* of the app for that) –  Nov 28 '17 at 07:39
  • If you want a substantial answer, you'll have to describe the relationship between Foo.lib, App.exe, and Addin.dll. Why is Foo.lib built alongside App.exe? Why does Addin.dll link it? Otherwise the answer is "could be safe, could be unsafe." – lockcmpxchg8b Nov 28 '17 at 08:08
  • @Felix Palmen Thanks for the comment Felix! You are correct that there are two versions of the code, older one as part of DLL and the newer one as part of the Application. That is how it is working as of now (without any issues fortunately!) I would like to know if the reverse case is equally safe (or risky!, however you wish to look at it)? i.e. newer version of static library code as part of DLL and older static library code as part of Application. – user3406792 Nov 28 '17 at 13:42
  • @lockcmpxchg8b Thanks for your comment! Foo.lib is actually code of APIs provided by App.exe. Addin.dll uses APIs provided by App.exe and hence links withFoo.lib. it will not be possible to explain the actual relationship in brief. I assumed the behaviour to be unpredictable, but fortunately enough our Addin.dll has not behaved unpredictably so far! – user3406792 Nov 28 '17 at 14:10

0 Answers0