Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DLL import problem

DLL import problem

Scheduled Pinned Locked Moved C#
helpc++csharpdotnetperformance
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SelvaKr
    wrote on last edited by
    #1

    Hi All, I am a newbie for C# currently working on a porting project. I need to port and use a VC++ (6.0) MFC extesion DLL methods in C# (8.0) application. To do that, I created a managed wrapper dll (MFC Regular DLL shared with /CLR turned ON) from C# and referred the MFC extension DLL from it. But when i call the interface function written in the wrapper DLL from the C# application, I am getting the below error. "Unable to load DLL 'TestWrapper.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)" This error occurs only when i add the MFC extension DLL as the dependency to the wrapper dll. If the remove that dependency 'TestWrapper.dll' loads successfully. Note: All DLLs and C# application is in the same path. Problem happens in Windows XP SP3. Any help is appreciated. Thanks in advance.

    Selva

    L 1 Reply Last reply
    0
    • S SelvaKr

      Hi All, I am a newbie for C# currently working on a porting project. I need to port and use a VC++ (6.0) MFC extesion DLL methods in C# (8.0) application. To do that, I created a managed wrapper dll (MFC Regular DLL shared with /CLR turned ON) from C# and referred the MFC extension DLL from it. But when i call the interface function written in the wrapper DLL from the C# application, I am getting the below error. "Unable to load DLL 'TestWrapper.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)" This error occurs only when i add the MFC extension DLL as the dependency to the wrapper dll. If the remove that dependency 'TestWrapper.dll' loads successfully. Note: All DLLs and C# application is in the same path. Problem happens in Windows XP SP3. Any help is appreciated. Thanks in advance.

      Selva

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      native code DLLs are located by Windows searching the folders listed in the PATH environment variable. Unless PATH contains a simple "." entry, putting the native DLL in your EXE's folder is insufficient. FWIW: when the native DLL calls on other DLLs, the same rules apply, and whatever DLL isn't found the error message will always be the same. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read formatted code with indentation, so please use PRE tags for code snippets.


      I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


      S 1 Reply Last reply
      0
      • L Luc Pattyn

        native code DLLs are located by Windows searching the folders listed in the PATH environment variable. Unless PATH contains a simple "." entry, putting the native DLL in your EXE's folder is insufficient. FWIW: when the native DLL calls on other DLLs, the same rules apply, and whatever DLL isn't found the error message will always be the same. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read formatted code with indentation, so please use PRE tags for code snippets.


        I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).


        S Offline
        S Offline
        SelvaKr
        wrote on last edited by
        #3

        Hi Luc, Thanks for you reply. But my problem was a little different. I had a few thread local variable declarations in the MFC DLL which caused problem while loading at runtime. Now working on it to change the implementation of the variable. Thanks again.

        Selva

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups