Issue while Use DLL in MFC Exe Application
-
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!
-
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!
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
-
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
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.
-
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.
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?
-
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?
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.
-
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.
ah yes! i should've remembered the module definition file.. glad you fixed your bug and shared the solution! :)