CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    907

    Selectively use dynamic linking?

    How can I create a program that is partially dynamically linked, and some parts set to statically linked (like some third party libraries)?
    Thanks
    Jack
    Last edited by lucky6969b; October 28th, 2015 at 08:51 AM. Reason: Solved by recompiling the program... no need to ask anymore

  2. #2
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: The linker cannot find the file I didn't specify in my project?

    You download the static libs for the 3p project if you want to link statically, otherwise the dynamic libs

    No proper libs available? If you have the source of the 3p project compile the lib yourself.
    Nobody cares how it works as long as it works

  3. #3
    Join Date
    Dec 2010
    Posts
    907

    Re: The linker cannot find the file I didn't specify in my project?

    Hello,
    I tried to wrap a big project which consists of a numerous sub-projects into statically linked library.
    But one of the sub-projects complains that
    The link time library (statically linked) is not suitable for a dynamically linked library as a final product.
    Thanks
    Jack

  4. #4
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: The linker cannot find the file I didn't specify in my project?

    Then I think you will have to investigate why they claim static linking is not suitable. I've seen this type of statement before and there are valid reasons for it, but could also be nonsense or simply the license which disallows static linking.
    Nobody cares how it works as long as it works

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: The linker cannot find the file I didn't specify in my project?

    A third party code (including plain C runtime) may be released in a library of various forms, e.g. static .lib or dynamic .dll.

    In case some of your code uses static library, and other does require to be linked with its DLL sibling, you cannot build all this into a single binary. You just can't. To solve that you may either get rid of inconsistency, i.e. use strictly the same type of third party library, .lib or .dll, all over your project, or you split your code to separate dlls, each one using only one type of third party library, and build your final app of the dlls.

    A problem inevitably introduced with the last approach is that you cannot be sure about a memory (de)allocation uniformity in case of mixing different libraries. And because of this, you need to take a special care about freeing particular objects in the same binary where it was allocated.
    Best regards,
    Igor

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