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. What is contained in lib?

What is contained in lib?

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 4 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.
  • J Offline
    J Offline
    JackPuppy
    wrote on last edited by
    #1

    What's the difference between import liberary and static program liberary, they seems to have the same suffix(.lib)? Can somebody provide me the explicit demonstration of lib file. BTW, i have learnt PE format already.

    S 1 Reply Last reply
    0
    • J JackPuppy

      What's the difference between import liberary and static program liberary, they seems to have the same suffix(.lib)? Can somebody provide me the explicit demonstration of lib file. BTW, i have learnt PE format already.

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      When you compile a file called, say, "A.cpp", you normally get an output file called "A.obj". Essentially a .lib file is a library that contains multiple .objfiles. Historically there was a separate command for creating them. If you've studied the PE file then you're already know most of what you after. See here[^].

      Steve

      _ J 3 Replies Last reply
      0
      • S Stephen Hewitt

        When you compile a file called, say, "A.cpp", you normally get an output file called "A.obj". Essentially a .lib file is a library that contains multiple .objfiles. Historically there was a separate command for creating them. If you've studied the PE file then you're already know most of what you after. See here[^].

        Steve

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        And an import library contains the signatures of the exported functions and the name of the DLL file that contains the actual implementation.

        «_Superman_» I love work. It gives me something to do between weekends.

        1 Reply Last reply
        0
        • S Stephen Hewitt

          When you compile a file called, say, "A.cpp", you normally get an output file called "A.obj". Essentially a .lib file is a library that contains multiple .objfiles. Historically there was a separate command for creating them. If you've studied the PE file then you're already know most of what you after. See here[^].

          Steve

          J Offline
          J Offline
          JackPuppy
          wrote on last edited by
          #4

          thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be equal of smaller in size than lib. And are you saying import liberay and static program liberary are exactly the same?

          E 1 Reply Last reply
          0
          • S Stephen Hewitt

            When you compile a file called, say, "A.cpp", you normally get an output file called "A.obj". Essentially a .lib file is a library that contains multiple .objfiles. Historically there was a separate command for creating them. If you've studied the PE file then you're already know most of what you after. See here[^].

            Steve

            J Offline
            J Offline
            JackPuppy
            wrote on last edited by
            #5

            thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be greater in size than lib. And are you saying import liberay and static program liberary are exactly the same?

            S 1 Reply Last reply
            0
            • J JackPuppy

              thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be equal of smaller in size than lib. And are you saying import liberay and static program liberary are exactly the same?

              E Offline
              E Offline
              Eytukan
              wrote on last edited by
              #6

              lib doesn't contain any "logic" inside. It's just a dummy. It contains information about the exported symbols from the dll. How will it have the same size of the dll then? But if it's a static library, yes, it will have brains and the size will be big. Unlike a dll, this static libraries get "fixed up" to the executables. But I guess you aren't concerned about the latter.

              He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

              S 1 Reply Last reply
              0
              • E Eytukan

                lib doesn't contain any "logic" inside. It's just a dummy. It contains information about the exported symbols from the dll. How will it have the same size of the dll then? But if it's a static library, yes, it will have brains and the size will be big. Unlike a dll, this static libraries get "fixed up" to the executables. But I guess you aren't concerned about the latter.

                He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                S Offline
                S Offline
                Stephen Hewitt
                wrote on last edited by
                #7

                VuNic wrote:

                lib doesn't contain any "logic" inside.

                That's not necessarily true. Import libraries just contain, essentially, function names and the name of the containing DLL, so it’s true in that case. However, the “other” sort of lib file contains machine code and data.

                Steve

                E 1 Reply Last reply
                0
                • J JackPuppy

                  thanks! why lib is smaller than dll? if lib is the combination of all objects, and dll also a combination of all objects(some have been allocated though), dll should be greater in size than lib. And are you saying import liberay and static program liberary are exactly the same?

                  S Offline
                  S Offline
                  Stephen Hewitt
                  wrote on last edited by
                  #8

                  It need not be. If it's an import library it will be quite small.

                  Steve

                  1 Reply Last reply
                  0
                  • S Stephen Hewitt

                    VuNic wrote:

                    lib doesn't contain any "logic" inside.

                    That's not necessarily true. Import libraries just contain, essentially, function names and the name of the containing DLL, so it’s true in that case. However, the “other” sort of lib file contains machine code and data.

                    Steve

                    E Offline
                    E Offline
                    Eytukan
                    wrote on last edited by
                    #9

                    Stephen Hewitt wrote:

                    That's not necessarily true. Import libraries just contain, essentially, function names and the name of the containing DLL, so it’s true in that case. However, the “other” sort of lib file contains machine code and data.

                    Did you really read my message till the end?

                    Stephen Hewitt wrote:

                    However, the “other” sort of lib file contains machine code and data.

                    But if it's a static library, yes, it will have brains and the size will be big. Unlike a dll, this static libraries get "fixed up" to the executables. But I guess you aren't concerned about the latter. I think both mean the same.

                    He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                    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