Generating .lib file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mickey22
    New Member
    • Feb 2007
    • 105

    Generating .lib file

    Hi all,

    I want to start a project that generates .lib file.Could anypone please tell me what are settings I need to use , like what aplication I have to use .

    I opened New Project->C++

    Many options like win32 Console, MFC DLL and so on.I am using Visual 2005 on Windows.

    Thanks.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Create a Win32 Project.

    When the wizard appears DO NOT click Finish.

    Instead, click Application Settings and select Static Library.

    You might want to de-select Precompiled headers unless you know how they work.

    Then click Finish.

    When you build the product will be a .lib and a corresponding .h

    Then all need do in another project is #include the header and ADD the .lib
    to the linker's list of libraries:
    1) Right click on project name
    2) Select Properties
    3) Select Linker in the left pane
    4) Select Input in the left pane
    5) Add your .lib in the right pane under Additional Dependencies
    5) Click OK.

    And off you go.

    Comment

    • mickey22
      New Member
      • Feb 2007
      • 105

      #3
      Thank you very much providing me with all the necessary steps.I will try to do in that way.Thanks.

      Comment

      • dubZ
        New Member
        • Mar 2007
        • 7

        #4
        What is the benefit/difference to using a .lib file as opposed to using a .dll?

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          Functions form a static library are copied to your executable and the linker points all the call to the functions it copied from the library. Hence the static.

          A dynamic library is loaded at run time. Here's a case where you can pull off a software upgrade just by sending your customers a newer dll. Had you used a static library you would need to redistrinute the entire program.

          Also, a statically linked program has the maximum memory footprint since everything was done by the linker. With a dll, you can unload it when you are finished and this reduces the memory requirements for your program.

          Comment

          Working...