locked
LoadPackagedLibrary() - loads DLL, then unloads it, returns NULL - why?

    Question

  • I have a project consisting of multiple DLLs. Some of these DLLs are loaded dynamically via LoadPackagedLibrary().

    Before anyone asks, yes, the DLL are part of my project and declared as content. They're copied to the AppX package and a small test DLL is loaded without any problems.

    However, the DLL I want to use is loaded and then immediately unloaded again:

    'OgreTest.exe' (Win32): Loaded 'D:\Ogre-WinRT\OgreTest\bin\x86\Debug\AppX\RenderSystemDirect3D11.dll'. Symbols loaded.
    'OgreTest.exe' (Win32): Unloaded 'D:\Ogre-WinRT\OgreTest\bin\x86\Debug\AppX\RenderSystemDirect3D11.dll'

    This makes me conclude that something is wrong with the DLL. But what? It's a metro DLL, built for the same platform and configuration as my project.

    Can I somehow increase the verbosity of the Visual Studio debugger or is there a way to find out why the DLL is being rejected (or whatever)?


    • Edited by Cygon4 Sunday, March 25, 2012 12:14 PM
    Sunday, March 25, 2012 12:13 PM

Answers

  • Okay, solved it myself. Dependency Walker balked on some kind of circular dependency, but in the end still displayed d3dcompiler_44.dll as missing. Added that to the project, declared it as content and now everything works and validates :)

    • Marked as answer by Cygon4 Sunday, March 25, 2012 12:37 PM
    Sunday, March 25, 2012 12:37 PM

All replies

  • I linked the DLL directly into my project and now I'm being told that "A dependent dll was not found":

    'OgreTest.exe' (Win32): Loaded 'D:\Ogre-WinRT\OgreTest\bin\x86\Debug\AppX\RenderSystemDirect3D11.dll'. Symbols loaded.
    'OgreTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d2d1.dll'. Cannot find or open the PDB file.
    'OgreTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\d3d11.dll'. Cannot find or open the PDB file.
    'OgreTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DWrite.dll'. Cannot find or open the PDB file.
    'OgreTest.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.110.Debug_11.0.50214.1_x86__8wekyb3d8bbwe\vccorlib110d.dll'. Symbols loaded.
    'OgreTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
    'OgreTest.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.110.Debug_11.0.50214.1_x86__8wekyb3d8bbwe\msvcp110d.dll'. Symbols loaded.
    'OgreTest.exe' (Win32): Loaded 'C:\Program Files\WindowsApps\Microsoft.VCLibs.110.Debug_11.0.50214.1_x86__8wekyb3d8bbwe\msvcr110d.dll'. Symbols loaded.
    'OgreTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
    'OgreTest.exe' (Win32): Loaded 'D:\Ogre-WinRT\OgreTest\bin\x86\Debug\AppX\FreeImage.dll'. Symbols loaded.
    The thread 0x79c has exited with code -1073741515 (0xc0000135).
    The program '[5912] OgreTest.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.

    That's all very nice, but which one? FreeImage is working, I checked that. I'll try if Dependency Walker can be used on WinRT projects.

    Sunday, March 25, 2012 12:27 PM
  • Okay, solved it myself. Dependency Walker balked on some kind of circular dependency, but in the end still displayed d3dcompiler_44.dll as missing. Added that to the project, declared it as content and now everything works and validates :)

    • Marked as answer by Cygon4 Sunday, March 25, 2012 12:37 PM
    Sunday, March 25, 2012 12:37 PM
  • Thanks for sharing the solution.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 26, 2012 3:06 AM