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. Unable to load DLL

Unable to load DLL

Scheduled Pinned Locked Moved C#
csharpc++visual-studiocomquestion
8 Posts 3 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.
  • D Offline
    D Offline
    donovan solms
    wrote on last edited by
    #1

    i get System.DllNotFoundException: Unable to load DLL 'touchlib.dll': The specified mo dule could not be found. (Exception from HRESULT: 0x8007007E) --at TouchlibInterop.Interop.init() --at TouchlibInterop.Interop.initialize() in C:\Documents and Settings\donovan\ My Documents\Visual Studio 2005\Projects\TouchlibInterop\TouchlibInterop\TouchlibInt erop.cs:line 54 even though the dll (touchlib.dll) is in the bin directory of the application i'm trying to run, and in the bin of the dll that's calling it. i've added a reference to the dll(touchlib.dll) in the dll that calls it(touchlibinterop.dll) and in the program that calls the dll. (consoleapptest) am i missing something? i'm using DLLImport to call a unmanaged c++ method from a C# DLL, and then from the console app i'm calling a method in the C# dll that calls the unmanaged Dll. thanks, donovan rather have something you don't need, than need something you don't have

    C L 2 Replies Last reply
    0
    • D donovan solms

      i get System.DllNotFoundException: Unable to load DLL 'touchlib.dll': The specified mo dule could not be found. (Exception from HRESULT: 0x8007007E) --at TouchlibInterop.Interop.init() --at TouchlibInterop.Interop.initialize() in C:\Documents and Settings\donovan\ My Documents\Visual Studio 2005\Projects\TouchlibInterop\TouchlibInterop\TouchlibInt erop.cs:line 54 even though the dll (touchlib.dll) is in the bin directory of the application i'm trying to run, and in the bin of the dll that's calling it. i've added a reference to the dll(touchlib.dll) in the dll that calls it(touchlibinterop.dll) and in the program that calls the dll. (consoleapptest) am i missing something? i'm using DLLImport to call a unmanaged c++ method from a C# DLL, and then from the console app i'm calling a method in the C# dll that calls the unmanaged Dll. thanks, donovan rather have something you don't need, than need something you don't have

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It's not a COM dll ? If it is, it still needs to be registered.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      D 1 Reply Last reply
      0
      • D donovan solms

        i get System.DllNotFoundException: Unable to load DLL 'touchlib.dll': The specified mo dule could not be found. (Exception from HRESULT: 0x8007007E) --at TouchlibInterop.Interop.init() --at TouchlibInterop.Interop.initialize() in C:\Documents and Settings\donovan\ My Documents\Visual Studio 2005\Projects\TouchlibInterop\TouchlibInterop\TouchlibInt erop.cs:line 54 even though the dll (touchlib.dll) is in the bin directory of the application i'm trying to run, and in the bin of the dll that's calling it. i've added a reference to the dll(touchlib.dll) in the dll that calls it(touchlibinterop.dll) and in the program that calls the dll. (consoleapptest) am i missing something? i'm using DLLImport to call a unmanaged c++ method from a C# DLL, and then from the console app i'm calling a method in the C# dll that calls the unmanaged Dll. thanks, donovan rather have something you don't need, than need something you don't have

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

        Hi, IIRC the unmanaged dll's that you refer to with [DllImport] must be in the Windows path (e.g. in C:\Windows\system32); the app's bin directory is only searched for managed code. Of course you could add your app's bin directory to the Windows path and put everything in there. :)

        Luc Pattyn [My Articles]

        D 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, IIRC the unmanaged dll's that you refer to with [DllImport] must be in the Windows path (e.g. in C:\Windows\system32); the app's bin directory is only searched for managed code. Of course you could add your app's bin directory to the Windows path and put everything in there. :)

          Luc Pattyn [My Articles]

          D Offline
          D Offline
          donovan solms
          wrote on last edited by
          #4

          i quickly tried that, but it doesn't seem to work, maybe i'm not compiling the unmanaged DLL correctly? i will write a different dll and try it with that one

          rather have something you don't need, than need something you don't have

          L 1 Reply Last reply
          0
          • C Christian Graus

            It's not a COM dll ? If it is, it still needs to be registered.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            D Offline
            D Offline
            donovan solms
            wrote on last edited by
            #5

            no not the touchlib.dll , that's a unmanaged dll that a COM dll is trying to access. when i type 'regasm touchlib.dll' it tells me that touchlib.dll or one of it's dependencies couldn't be found, could it be a dependency? or am i missing something when i compile? maybe you can tell me what compile options MUST be set to get DLLImport to work with it? could i not be exporting symbols?

            rather have something you don't need, than need something you don't have

            C 1 Reply Last reply
            0
            • D donovan solms

              no not the touchlib.dll , that's a unmanaged dll that a COM dll is trying to access. when i type 'regasm touchlib.dll' it tells me that touchlib.dll or one of it's dependencies couldn't be found, could it be a dependency? or am i missing something when i compile? maybe you can tell me what compile options MUST be set to get DLLImport to work with it? could i not be exporting symbols?

              rather have something you don't need, than need something you don't have

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              donsolms wrote:

              maybe you can tell me what compile options MUST be set to get DLLImport to work with it?

              None. It sounds like your dll is missing a dependancy, if the dll is there. It's unmanaged, does it need MSVCRT, or the MFC dll ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

              1 Reply Last reply
              0
              • D donovan solms

                i quickly tried that, but it doesn't seem to work, maybe i'm not compiling the unmanaged DLL correctly? i will write a different dll and try it with that one

                rather have something you don't need, than need something you don't have

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

                Hi, I reread your original post, and I am getting the impression you did it again: using DllImport on a dll for which you were able to add a reference. AFAIK it is one or the other: - unmanaged code dll's need DllImport and can not be added as a reference; - for managed code a reference must be added, and DllImport wont work. I am not sure how it works for a COM dll, I expect you need to add a reference and dont need DllImport... :)

                Luc Pattyn [My Articles]

                C 1 Reply Last reply
                0
                • L Luc Pattyn

                  Hi, I reread your original post, and I am getting the impression you did it again: using DllImport on a dll for which you were able to add a reference. AFAIK it is one or the other: - unmanaged code dll's need DllImport and can not be added as a reference; - for managed code a reference must be added, and DllImport wont work. I am not sure how it works for a COM dll, I expect you need to add a reference and dont need DllImport... :)

                  Luc Pattyn [My Articles]

                  C Offline
                  C Offline
                  Christian Graus
                  wrote on last edited by
                  #8

                  Luc Pattyn wrote:

                  I am not sure how it works for a COM dll, I expect you need to add a reference and dont need DllImport...

                  That is correct.

                  Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                  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