0

So I was working with a code base, where I was tryn to build a project, what I observed in the release directory, that we also have the lib for the same dll.

How is it possible? How can I configure the same on visual studio to build both dll and lib for my project at once.

EDIT : The code base that I am working with generates both dll and lib files. However my software uses just the dll files. Then why did we generate libs at the first place?

puja deo
  • 31
  • 9
  • If you didn't have a lib file nobody would be able to link against your dll, it's generated automatically if your dll has exports – Alan Birtles May 09 '21 at 08:10
  • https://stackoverflow.com/questions/56085753/why-do-we-need-lib-file-in-case-of-importing-functions-from-dll – Retired Ninja May 09 '21 at 08:13
  • @AlanBirtles But lib files are used for static linking, why is it even needed then? if all I am intereseted is dll. Also at the end of the end I am using dll while running my application then why do we even need that lib in the first place – puja deo May 09 '21 at 08:55
  • @pujadeo It's not a static lib (with code) it's an import library to fixup the client to call the code in the DLL without having to use `GetProcAddress` to fixup each function individually. https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-creation#:~:text=An%20import%20library%20(.,when%20you%20build%20your%20DLL. – Richard Critten May 09 '21 at 09:09
  • ok so do you mean these import lib library are intermidiate temp files, that has no use after build? – puja deo May 09 '21 at 09:19
  • @pujadeo depends on what you intend to do with the DLL. If you are also writing the client you link with the LIB to enable fixup of the runtime dependencies (to save you doing all the fixups manually). – Richard Critten May 09 '21 at 09:44
  • Didn't get it, what do you mean exactly? – puja deo May 09 '21 at 12:10

0 Answers0