CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2013
    Posts
    10

    .dlls in visual studio c++

    When you are using a generic library that comes with .libs, .h headers, and .dll's, you configure a new project and point VC++ to look at the directories configured in the project properties. But where in the project properties do you add a pointer to the dll's? Right now I have to modify the system PATH variable or copy the DLLs into the build directory.
    In other words, how do I point VC++ to the DLLs when I start debugging because unless the DLLs are in the build directory, launching a debug session will cause a crash saying the DLL cannot be found.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: .dlls in visual studio c++

    Quote Originally Posted by bigc++ View Post
    When you are using a generic library that comes with .libs, .h headers, and .dll's, you configure a new project and point VC++ to look at the directories configured in the project properties. But where in the project properties do you add a pointer to the dll's?
    DLL's are not involved in the build process. A DLL file only comes into play when you run your program, so there is no such thing as "pointing to a DLL" in Visual Studio.
    how do I point VC++ to the DLLs when I start debugging
    Again, there is no such thing as "pointing to a DLL". It is the responsibility of the OS to find and load the DLL, and there are rules as to how the OS searches for DLLs.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: .dlls in visual studio c++

    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: .dlls in visual studio c++

    either have all the projects in a single solution and have all projects output to the same directory (the default for new projects in VS)

    or have a custom build step in the .dll project to copy the dll to the output dir of the exe hosting the dll each time it's built... or to a directory already in the PATH.

    or have a custom build step in the .exe project to copy the dll to the output dir of the exe hosting the dll each time it's changed.

    or change the DLL loading code to use a full path (if using LoadLibrary)

    or change the PATH to add the dll output dir.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured