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. Issue while Use DLL in MFC Exe Application

Issue while Use DLL in MFC Exe Application

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++sysadmintesting
6 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.
  • A Offline
    A Offline
    Andraw Tang
    wrote on last edited by
    #1

    Hi, dear all, I create a DLL (we called Server.DLL)with several exported functions, I also create testing application (Client.EXE) to call the exported functions in DLL, both are in debug mode. Everything works fine. Now I need to create a DLL in release mode, so I use the Server.DLL and Client.EXE for release mode, and change the compiled files for debug mode as Sever_Debug.DLL, Client_Debug.EXE, also in the project setting part of the client application, I change the following settings: Link ->General->Object/Library modules as Server_Debug.LIB, Link ->General->Input->Additional Library Path to the server project Debug folder. After I compile the client application and run the program, I got an error: The application has failed to start because Server.DLL was not found. Re-installing the application may fix this problem. My question is that why it still look for Server.DLL, suppose it should look for Server_Debug.DLL, right? Is there any place to let use set the path and name for the DLL file or we just put the DLL file at the same folder as client application exe file, and by default DLL file name should be same as LIB file name, am I right? Thanks a lots!

    A 1 Reply Last reply
    0
    • A Andraw Tang

      Hi, dear all, I create a DLL (we called Server.DLL)with several exported functions, I also create testing application (Client.EXE) to call the exported functions in DLL, both are in debug mode. Everything works fine. Now I need to create a DLL in release mode, so I use the Server.DLL and Client.EXE for release mode, and change the compiled files for debug mode as Sever_Debug.DLL, Client_Debug.EXE, also in the project setting part of the client application, I change the following settings: Link ->General->Object/Library modules as Server_Debug.LIB, Link ->General->Input->Additional Library Path to the server project Debug folder. After I compile the client application and run the program, I got an error: The application has failed to start because Server.DLL was not found. Re-installing the application may fix this problem. My question is that why it still look for Server.DLL, suppose it should look for Server_Debug.DLL, right? Is there any place to let use set the path and name for the DLL file or we just put the DLL file at the same folder as client application exe file, and by default DLL file name should be same as LIB file name, am I right? Thanks a lots!

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #2

      actually your stuff looks ok although its more common to have a debug target folder instead of different name for debug version (MS does have different names though since they distribute both)... do a search for "Server.DLL" in your project, maybe you're referencing the name and don't forget to recompile the server.dll to produce server_debug.dll

      A 1 Reply Last reply
      0
      • A Albert Holguin

        actually your stuff looks ok although its more common to have a debug target folder instead of different name for debug version (MS does have different names though since they distribute both)... do a search for "Server.DLL" in your project, maybe you're referencing the name and don't forget to recompile the server.dll to produce server_debug.dll

        A Offline
        A Offline
        Andraw Tang
        wrote on last edited by
        #3

        Thanks for reply. I recompile the DLL in debug mode and also search for Server.DLL in client application, cannot find it. usually when use DLL file, we just set the library file name and path, don't need to directly DLL file name and path, just put the DLL in the same folder as EXE file, right? I don't know from where the client application remember the Server.DLL.

        A 1 Reply Last reply
        0
        • A Andraw Tang

          Thanks for reply. I recompile the DLL in debug mode and also search for Server.DLL in client application, cannot find it. usually when use DLL file, we just set the library file name and path, don't need to directly DLL file name and path, just put the DLL in the same folder as EXE file, right? I don't know from where the client application remember the Server.DLL.

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #4

          If you didn't specify the path of the DLL anywhere, it should just look in the same directory as the exe. I'll think about this a little bit to see if I can remember anything that may cause this... did you do a clean recompile?

          A 1 Reply Last reply
          0
          • A Albert Holguin

            If you didn't specify the path of the DLL anywhere, it should just look in the same directory as the exe. I'll think about this a little bit to see if I can remember anything that may cause this... did you do a clean recompile?

            A Offline
            A Offline
            Andraw Tang
            wrote on last edited by
            #5

            Hi, Albert, Thank you very much, I solve this problem. The problem is in the .def file, it has LIBRARY : SERVER so if I want to change the library file to SERVER_Debug, I also need to change the library name in .def file. So I thought your idea is good, no matter in debug or release mode, use the same name, just output the files in debug and release to different folder, so we don't need to modify .def file. Thanks again.

            A 1 Reply Last reply
            0
            • A Andraw Tang

              Hi, Albert, Thank you very much, I solve this problem. The problem is in the .def file, it has LIBRARY : SERVER so if I want to change the library file to SERVER_Debug, I also need to change the library name in .def file. So I thought your idea is good, no matter in debug or release mode, use the same name, just output the files in debug and release to different folder, so we don't need to modify .def file. Thanks again.

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              ah yes! i should've remembered the module definition file.. glad you fixed your bug and shared the solution! :)

              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