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. Creating c++ static library that uses 3rd party static libraries.

Creating c++ static library that uses 3rd party static libraries.

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiooopquestion
5 Posts 3 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
    Maximilien
    wrote on last edited by
    #1

    (C++ and Visual Studio 2019) We have a 3rd party library that we want to use (we build from source and it generates many, many static libs). I want to create an abstraction layer on top of this 3rd party library, as a static library. And I want my client application to use my own abstraction layer so it does not have to directly include the 3rd party headers. Can I "link" the 3rd party libraries (libs) in my own library so that I can just link we one library in my client application ? Or I will need to link my application with the 3rd party libraries as well as my own library ?

    I'd rather be phishing!

    L Mircea NeacsuM 2 Replies Last reply
    0
    • M Maximilien

      (C++ and Visual Studio 2019) We have a 3rd party library that we want to use (we build from source and it generates many, many static libs). I want to create an abstraction layer on top of this 3rd party library, as a static library. And I want my client application to use my own abstraction layer so it does not have to directly include the 3rd party headers. Can I "link" the 3rd party libraries (libs) in my own library so that I can just link we one library in my client application ? Or I will need to link my application with the 3rd party libraries as well as my own library ?

      I'd rather be phishing!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If you create a static library that links to other statics then the result should be a single static library. A simple test should confirm it for you.

      M 1 Reply Last reply
      0
      • M Maximilien

        (C++ and Visual Studio 2019) We have a 3rd party library that we want to use (we build from source and it generates many, many static libs). I want to create an abstraction layer on top of this 3rd party library, as a static library. And I want my client application to use my own abstraction layer so it does not have to directly include the 3rd party headers. Can I "link" the 3rd party libraries (libs) in my own library so that I can just link we one library in my client application ? Or I will need to link my application with the 3rd party libraries as well as my own library ?

        I'd rather be phishing!

        Mircea NeacsuM Offline
        Mircea NeacsuM Offline
        Mircea Neacsu
        wrote on last edited by
        #3

        You can create a "composite" that includes your modules and all modules from 3rd party libraries. About including the 3rd party header files, it depends how good of a job you do at hiding the internals from your users. Thing to keep in mind: remove any #pragma directives that reference the previous libraries. Place only one referring to your "composite" lib in one of your main include files.

        Mircea

        1 Reply Last reply
        0
        • L Lost User

          If you create a static library that links to other statics then the result should be a single static library. A simple test should confirm it for you.

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

          Crikey I did not even look at that (bad case of mondaying) It seems to be working. Thanks Richard.

          I'd rather be phishing!

          L 1 Reply Last reply
          0
          • M Maximilien

            Crikey I did not even look at that (bad case of mondaying) It seems to be working. Thanks Richard.

            I'd rather be phishing!

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Yes, it's the sort of question that gets you overthinking in your head. :laugh:

            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