Forum Discussion
kerenor
Jan 29, 2024Copper Contributor
Is there a way to allow loading dlls from a non-trivial path in MSIX?
Hi all,
I'm trying to find a way to make programs inside MSIX load dlls from the environment variable PATH, or from any external-to-the-msix location that isn't C:\Windows\system32.
In detail, I want to be able to load gstreamer from an application packaged in MSIX; the dlls of gstreamers are found in C:\gstreamer\1.0\msvc_x86_64\bin.
When adding C:\gstreamer\1.0\msvc_x86_64\bin to the environment variable PATH, the executable runs without errors. However, if I include the executable in the MSIX, it fails to load these dlls.
I found that packaged apps don't even look at the PATH environment variable when loading dlls (microsoft link), which begs the question... how can I tell the MSIX to load dlls from there?
it is not really an app installation, so can't be added as a package dependency.
It looks like something that might be handled in PSF somehow, but I couldn't find how.
Thanks for any advice!
kerenor You didn't mention how the app is created.
If you are the developer, there are developer APIs to add folders to the dll loading list at runtime, such as "SetCurrentDirectory".
If you are not a developer, the AppXManifest has a package level extension called LoaderSearchorder which can be used to define static folders to add. If the dlls are contained within the package, you can also try one of the following:
- Package Support Framework (PSF) DynamicLibraryFixup
- Copy the dlls to the VFS\SystemX86 or VFS\SysWow64 folders in the package before creating it.
- kerenorCopper Contributor
TIMOTHY_MANGAN Thanks for your response!
The dlls are not contained within the package, they are in some arbitrary path outside (specifically C:\gstreamer\1.0\msvc_x86_64\bin.) I will probably be able to get the development teams to add that directory in development, but I'm also curious to learn more about the LoaderSearchorder extension.
In the documentation I couldn't find it - I found LoaderSearchPathOverride and LoaderSearchPathEntry, and both of them are relative to the app package root path which is not what I need (unless I'd do something like "..\..\..\..\gstreamer\1.0\msvc_x86_64\bin" ... which seems like not the greatest practice).
If you have reference to LoaderSearchorder that would be of great help
Thanks!
- Here is the reference from the schema:
https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap6-loadersearchpathoverride
Paths added must be relative paths; part of the package.