Forum Discussion

Dooyoul Chung's avatar
Dooyoul Chung
Copper Contributor
Oct 31, 2018

Msix : how to load DLL from other msix package.

There is a good MS documentation about msix extension. 

https://docs.microsoft.com/en-us/windows/uwp/launch-resume/extend-your-app-with-services-extensions-packages?context=/windows/msix/render

 

However, still challenge to figure out how to load C++ DLL that installed with "optional package".
For example, I have mainapp.msix(mainapp.exe) and en-us.msix (which contains en-us\mainappres.dll) those are installed unique container under WindowsApps. Is there any msix configuration supported to load en-us\mainappres.dll from mainapp.exe LoadlibraryEX()? 

Found that "Optional package" samples https://github.com/AppInstaller/OptionalPackageSample. Which shows load optional DLL.  Is that means traditional LoadlibraryEX() won't able to load resource DLL that installed from additional language pack Msix?

I've tried with resource DLL MSIX with set MainPackageDependency but still no luck. 
Any suggestions and/or ideas? or this is _not_ supported.


Regards,

 

6 Replies

  • Andy Liu's avatar
    Andy Liu
    Former Employee

    Are you modeling the en-us.msix as an optional package or as a language resource pack?

     

    You can only load dlls from optional packages, not language resource packs, if your dll is currently contained in a resource pack then you should move it to be part of the main package or change the resource pack to be an optional package.

     

    If you are already using it as an optional package, then can you try using LoadPackagedLibrary (showed in the sample)?

    • Dooyoul Chung's avatar
      Dooyoul Chung
      Copper Contributor

      Hi Andy,

       

      Thanks for reply. I've set en-us.msix as an optional package.

      I've switch from LoadLibraryEx() to LoadPackagedLibrary() but still does not working.

       

      If I set en-us.msix as "Framework" and set <PackageDependency> from mainapp.msix then I can load mainappres.dll from mainapp.exe.  However the en-us.msix is an option package of mainapp.msix not a "Framework".

      Is there other way of I can define appmanifest.xml either mainapp.msix or en-us.msix can load DLL  the same way as en-us.msix defined with "Framework".


      Thanks for sharing your suggestion. 

Resources