Alias API - The wrong .dll file is loaded for Alias 2021.3

Alias API - The wrong .dll file is loaded for Alias 2021.3

stine7PTB4
Explorer Explorer
774 Views
2 Replies
Message 1 of 3

Alias API - The wrong .dll file is loaded for Alias 2021.3

stine7PTB4
Explorer
Explorer

We have an application that uses the Alias 2021.3 API, but we encountered a problem. If Alias 2021.3 and an older version of Alias are installed, libalias_api.dll is loaded from <Older Alias Installation Path> / bin, and this means that our application crashes. If Alias 2021.3 is the only version installed, libalias_api.dll is loaded correctly from <Alias 2021.3 installation path> / bin.

 

Is there a way that we can force the API to load the libalias_api.dll file from the correct place?

0 Likes
Accepted solutions (1)
775 Views
2 Replies
Replies (2)
Message 2 of 3

rauscht
Autodesk
Autodesk
Accepted solution

Hi,

 

to start with: here is a link to Microsoft's description on the search order for loading DLL's: 
https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order?redirectedfrom...
This might be helpful as background information.

 

By reading your description, I guess the program we are looking at is a command line executable (rather than an Alias plug-in), right? If that's correct, please refer to section "Standard Search Order for Desktop Applications" in that linked page.

 

The bottom line in your case basically is: 
If an Alias version older than 2021.3 is been installed after Alias 2021.3 has been, then the substring "<Older Alias Installation Path>/bin" is been added to the PATH environment variable before the occurrence of substring "<Alias 2021.3 installation path>/bin". Consequently, libalias_api.dll is been found in "<Older Alias Installation Path>/bin" (as directories listed in PATH are searched from the beginning to the end).

 

Unfortunately, there is no "one size fits all" solution for that "DLL Search Path issue". Possible ways to get though are:

  • Make sure "<Alias 2021.3 installation path>/bin" is first in PATH
    This could be achieved by introducing a batch file / power shell script which changes the PATH environment variable accordingly, then starts your executable, and finally changes the PATH environment variable back its original value. (You might even want to consider to add a short cut to your desktop which calls that batch file. This is helpful in case users will call your program quite frequently.)
  • Make sure your executable is started from "<Alias 2021.3 installation path>/bin"
    This could be achieved by either introducing a batch file, or by adding a desktop short cut and adjusting the "Start in" location in the properties of that short cut

There might be more possible solutions. I guess the ones I have listed already meet your requirements.

Hth

Thomas



Thomas Rausch

Software Development Manager
0 Likes
Message 3 of 3

stine7PTB4
Explorer
Explorer

Thank you Thomas, your answer helped a lot.

0 Likes