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 / C++ / MFC
  4. can i create a dll, what includes other dlls?

can i create a dll, what includes other dlls?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
4 Posts 4 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.
  • M Offline
    M Offline
    mwolf122
    wrote on last edited by
    #1

    I convert an application code to dll file. I use functions from other dlls. In my application code, I have include a header files for the dlls and it works. In the dll file, I included the same header files, but the dll can not be loaded successfully, with a link error LNK2001. how can i set the path for the dll? thx. Lei

    H M M 3 Replies Last reply
    0
    • M mwolf122

      I convert an application code to dll file. I use functions from other dlls. In my application code, I have include a header files for the dlls and it works. In the dll file, I included the same header files, but the dll can not be loaded successfully, with a link error LNK2001. how can i set the path for the dll? thx. Lei

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      It seems your dll needs to a lib file.

      1 Reply Last reply
      0
      • M mwolf122

        I convert an application code to dll file. I use functions from other dlls. In my application code, I have include a header files for the dlls and it works. In the dll file, I included the same header files, but the dll can not be loaded successfully, with a link error LNK2001. how can i set the path for the dll? thx. Lei

        M Offline
        M Offline
        Matthew Faithfull
        wrote on last edited by
        #3

        Yes. You need to link your Dll project with the .lib files from the Dlls your project calls into. If you don't have .lib files for the dlls you need to use then you'll have to load them at runtime using the LoadLibrary API function and use GetProcAddress to get function pointers to the entry points for the functions you want to call. If all this seesm a bit arcane then at least you now know why COM got invented. :)

        Nothing is exactly what it seems but everything with seems can be unpicked.

        1 Reply Last reply
        0
        • M mwolf122

          I convert an application code to dll file. I use functions from other dlls. In my application code, I have include a header files for the dlls and it works. In the dll file, I included the same header files, but the dll can not be loaded successfully, with a link error LNK2001. how can i set the path for the dll? thx. Lei

          M Offline
          M Offline
          malaugh
          wrote on last edited by
          #4

          If you do not want to use "loadlibrary" see other reply) 1) You cannot set a path for a DLL, you must either have your new DLL in the same directory as the DLL you are calling, or put it in the windows/system32 directory. 2) You need to link the lib file. Either add the lib file using project properties or add following to your source file #pragma comment(lib,"DllName.lib") 3) Add the header file for the DLL to your source file.

          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