windows - How can an EXE have static dependency on a DLL? -


often when trying run exe uses dll, if dll missing standard windows error:

the program can't start because xxx.dll missing computer. try reinstalling program fix problem.

this seems built-in exe before of code gets called... how work, , how set when building project in visual studio?

edit:

in specific scenario have dll has "static" dependencies on other dlls if aren't present, registering dll fails little hard diagnose. i'd rather not manually list ever dll function used there lots!

when link dll there 2 ways this, implicit linking , explicit linking. encountering failure of implicit linking.

implicit linking operates through called import table contained in executable image uses pe (portable executable) format. pe format defines both import , export tables. export table contains list of functions exported dll, , entry points. import table contains implicit dependencies on other modules.

when executable starts loader reads import table , tries load dlls referenced , functions in dlls. can fail if dll not found, if dll fails load properly, or if dll not contain referenced functions. in case failing because loader did not find xxx.dll in dll search path.

the linker generate import table. in c++ typically done via .lib file dll.

explicit linking code calls loadlibrary , getprocaddress load dll , functions. typically approach used when want write app can run on different systems. example may wish use functions present on versions of os, degrade other behaviour when run on older version of os.

the term static should not used when referring linking dlls. static linking when implementation of function included in image rather contained in external library.

the msdn article on topic explains , more.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -