Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
azielinski Absent Member.
Absent Member.

Load an external DLL into ModScript


I wrote a C++ DLL which will be loaded from a ModScript. This DLL depends on some additional DLLs. The only solution to bring all this to work is to copy all additional DLLs into the system32 folder 😞
I tried also the suggested ways from SBM documentation to set location to DLLs in PATH variable and to set registry key ScriptAppPath. The result was that my self-written DLL can be found directly in ModScript without an absolute path to it, but it seems that the additional DLLs are not expected at this location.

Is the system32 folder is the only place to store additional DLLs, or is it possible to store them in a better location on hard disk?

Thanks and Regards,
1 Reply
Micro Focus Contributor
Micro Focus Contributor

Re: Load an external DLL into ModScript

Hello Andre,

I haven't checked this recently, but last time I did the search order Windows uses to locate DLLs is:
  • The directory containing the executable that wants to load the DLL.
  • The current directory, also known as the "Start in" directory.
  • The %SystemRoot%\system32 directory (eg. C:\WINNT\system32).
  • The %SystemRoot%\system directory (eg. C:\WINNT\system).
  • The %SystemRoot% directory (eg. C:\WINNT).
  • The directories specified in %PATH%, left to right.

    When the executable is IIS, #1 and #2 are not obvious (and likely a system directory, given it's an OS component), but the remainder well defined. You probably want to avoid all variants of %SystemRoot%, which gets us to %PATH%. This really ought to work, but a gotcha here is that PATH gets inherited by the executable at process startup, so changes to PATH normally don't get noticed until the process is restarted.

    If you did not already try restarting WWW Publishing Services (and anything App Pool related) after changing %PATH%, do so now. If that doesn't work, and it's an option, reboot the OS - this will ensure every single process inherits the new PATH. (And just in case: make sure you've updated the PATH in the System variables section, not the User variables one.)

    Hope this helps!

    - Richard.
    The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.