Unable to locate component when statically loading mixed mode dll from native exe on XP and Server 2003 RRS feed

  • Question

  • My setup looks like this:

    [Native MFC exe] -> [Mixed mode DLL] 

    The DLL is statically loaded by the EXE, and we are targeting .NET framework 3.5. 

    On Server 2008 it runs fine. On Server 2003, or XP, the app doesn't run. The process runs for a fraction of a second and then exits. No error dialog, nothing - just exits. We noticed some events in event viewer that showed a c0000135 coming from the DLL. When running from a debugger on Server 2003, it doesn't show anything obvious. We couldn't get the debugger to break on the exception, and we were unable to determine exactly what component couldn't be loaded.

    We tried changing the DLL to be delay-loaded by the exe, instead of statically loaded. When we try this, it runs fine on all platforms. 

    I tried to reproduce the issue in a simple project without success, which leads me to believe it could be any number of settings or dependencies of the DLL that are causing the problem. 

    Any ideas as to exactly what's going on here? Are there any potential issues with this sort of set up on XP or Server 2003? Any tips to help us figure this one out would be greatly appreciated :)

    Wednesday, March 23, 2011 1:28 AM


  • Hi Adrian,


    Welcome to the MSDN forum!


    According to your description, we have other information need to confirm. Is your target computer 32-bit or 64-bit (we need to know both Server 2008 and Server 2003)?


    I think there may be some mistakes in your mixed dll.

    1.    One possible thing is closed to the platform option.

    It is closed to the platform option that your mixed dll compiled with. If it is a 32-bit supported dll, it may cause some problems when it is loaded.

    2.    Another possible thing is that there are some runtime errors in the dll.

    I mean that there are some errors in your mixed dll. The errors will not occur while code is compiled, but occurs in run-time. So when statically load the mixed dll (at run-time), error occurs. But if your delay-load the dll, it won’t load the dll immediately. And programs may not call the function with errors in the dll. So it will run without problems.


    I suggest that you can check the platform option of your mixed dll and your application firstly and then check the code in your mixed dll.


    Have a nice day!

    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eryang Monday, April 11, 2011 3:08 AM
    Sunday, March 27, 2011 6:30 AM