Forum Discussion
bill_qu
Feb 14, 2025Copper Contributor
The strange problem of C # program calling C++dll
My C # calls C++DLL and runs it directly in VS2022 without any errors. We use LoadLibrary to load DLLs.
Packaged as. msix package, after installation, click on the icon of the application to run, some DLLs, error message
Error code 126 or 0.
But running this. exe file directly in the installation directory (Windows apps/applications) does not generate any errors.
I don't know where the problem lies now? How to solve it?
The most common cause of loadlibrary failure in an MSIX package is that it doesn't know where to look. For apps that are used to running outside of the package, this is most commonly solved by one of the following:
- Add a LoaderSearchOrder extension to the package listing the relative file path of a folder containing the dlls.
- Put the dlls either at the root folder of the package, or in the appropriate VFS\SystemX86 and VFS\SystemX64 folders of the package.
The most common cause of loadlibrary failure in an MSIX package is that it doesn't know where to look. For apps that are used to running outside of the package, this is most commonly solved by one of the following:
- Add a LoaderSearchOrder extension to the package listing the relative file path of a folder containing the dlls.
- Put the dlls either at the root folder of the package, or in the appropriate VFS\SystemX86 and VFS\SystemX64 folders of the package.
- CrazylarryCopper Contributor
You can just open it up in Notepad and copy/paste the contents here
- CrazylarryCopper Contributor
Hello. So you are saying that running the application via its shortcut fails, but running it by the EXE directly works? Can you share the AppxManifest.xml of your package?