Summary
This article presents some information on the UseDLL() function
Synopsis
The UseDLL() function is explained in the InstallShield help document. However this knowledge base article will explain in further detail, how you can force the UseDLL() function to bypass it's default load order and use a specific path to search for dependancy files.
Discussion
If your .dll and dependency files are located in the same folder, then using the ChangeDirectory() call to set the current folder to this path should allow the UseDLL() to load the dependency files as expected. However, the UseDLL() function goes through a load order, as explained in the following MSDN article Dynamic-Link Library Search Order. In short, UseDLL() will first check the Windows Systems folders for the dependancy files, before it checks the current directory.
NOTE: It's bad practice to include any dependancy system files and you should remove these files if you are doing so.
o if you are including a third party dependancy.dll, which can also be found in the Windows System folder, then due to the load order the copy found in thw Windows System folder will always be used. The information below will show you how to bypass this load order and force UseDLL() to load dependency files from a specific path.
Workaround
You have two options to handle this.
- Calling the UseDLL() function multiple times.
This option basically means that you will first call the UseDLL() function to load all dependancy files into memory before calling the UseDLL() function on your actual .dll file. This approach should avoid load order issues, while still allowing you to use the specific dependency files you want. - Use SetDllDirectory() API.
This option will make use of the SetDllDirectory() API to force the search path for dependency files...
prototype BOOL Kernel32.SetDllDirectory(BYREF WSTRING);
So if you call SetDllDirectory() before your UseDLL() call like so...
SetDllDirectory(szMyDirPath);dllPath=szMyDirPath^"upgrade.dll";nResult = UseDLL(dllPath);
...it will bypass the default search path and go to szMyDirPath to load any dependent files.
Now this API call will affect the search order on the system, so you will need to reset the default search order bay passing in NULL to the SetDllDirectory() api. To do so, you can take a look at the help document Using Null-Delimited Strings and basically set (szDirectory = "\0") as \0 is the escape sequence for a null character.
Related Articles
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add additional feedback (optional)
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
|
FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513
(toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367
(toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895
2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago