windows - How can I find the full path of a DLL without actually calling LoadLibrary? -


if call loadlibrary("foo.dll"), in various locations on system, choose best match, , load library. find full path file before loading it. there simple way this? google-fu has far failed me, seems intuitive there function this. current solution call loadlibraryex load_library_as_datafile flag, getmodulefilename on result; after assume have release library , reload without flag, seems roundabout method. there better way? resolvepathfromdllname perhaps?

you can use searchpath, if you're planning on calling loadlibrary later it's not recommended (see remarks section on linked page (and quoted below in answer) regarding possibly returning wrong results).

note search order different of loadlibrary, because doesn't make same presumptions @ start of search documented in loadlibrary. strictly searches path documentation says does; doesn't automatically first in same folders. see paragraph in remarks:

the searchpath function not recommended method of locating .dll file if intended use of output in call loadlibrary function. can result in locating wrong .dll file because search order of searchpath function differs search order used loadlibrary function. if need locate , load .dll file, use loadlibrary function.

so proper answer question use loadlibrary in first place (as are) make sure you're finding same dll you'll loading later.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -