Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Static Library for Windows developer
Forum Updated to NodeBB v4.3 + New Features

Static Library for Windows developer

Scheduled Pinned Locked Moved C++ Gurus
4 Posts 2 Posters 2.0k 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.
  • IamSumitI Offline
    IamSumitI Offline
    IamSumit
    wrote on last edited by
    #1

    Hello
    I am creating my pure c++ library using the following link
    http://msdn.microsoft.com/en-us/library/ms235627.aspx

    -is this the right way for creating the library ?
    -can i use this library in both Qt Application and Visual studio without any problem?
    -can i do change my library if any made after creation the lib?
    -or is there any better way to create library so that it can be used by window c++ developer using any tool/IDE?

    Be Cute

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      Hello
      I am creating my pure c++ library using the following link
      -is this the right way for creating the library ?

      This is the right way to create a static library, yes.

      -can i use this library in both Qt Application and Visual studio without any problem?

      I'm not sure to understand fully your question: you can link any application (Qt, non Qt) against this lib. The only requirement is that the application must be built with Visual Studio as well (and maybe the same version for static libs, although I'm not sure about this).

      -can i do change my library if any made after creation the lib?
      -or is there any better way to create library so that it can be used by window c++ developer using any tool/IDE?

      You can change it and recompile it (i.e. recreating it), but then you will have to recompile every single application using it.

      You can go with a shared library to remove the requirement that any using application must be recompiled, but then you have to face the dll limitations (C interface, etc.).

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • IamSumitI Offline
        IamSumitI Offline
        IamSumit
        wrote on last edited by
        #3

        Thanks for respond.

        My Question was if i create a static lib using MSVS then can i use it inside Qt Application using Qt Creator and any other Qt/MSVS like C++ tool.

        Which one is better .lib or .dll ?

        Be Cute

        1 Reply Last reply
        0
        • JohanSoloJ Offline
          JohanSoloJ Offline
          JohanSolo
          wrote on last edited by
          #4

          OK, so the answer to your first question is yes, you can.

          Which one is better is a bit trickier... As you may know, shared libraries on windows have (according to me) some limitations:

          • only exported symbols can be used, i.e. you need to add some keywords here and there in order to be able to use your functions
          • exported function must have pure C signature (i.e. no overloading allowed, no by-reference arguments)
          • I never tried to export classes on windows, therefore I won't comment on this.

          On the other hand static libraries allow you to use any code (which can be real C++, classes, overloads, etc.) you want in the application which uses them. The drawback is that since it is linked to your application at compile time, a new version of the library requires a recompilation of every application which is using the library.

          This is why most of the people use static libraries for their core classes and creates shared libraries to give to the end-users (the shared libraries being linked against the static ones).

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved