CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2013
    Posts
    31

    Library File Format questions.

    I am happily and successfully running

    Windows 10 64 bit Home Edition
    TDM 64 bit C++ 5.2 compiler.

    I have found that when it comes to libraries, sometimes the windows library file
    (not the associated headers) are occasionally named *.a and *.lib.
    As a TDM programmer, I have learned that both names and formats will work.

    -On Windows, within 64 bit, what is the difference between the *.a format
    and the *.lib format?

    -If I am not able to use Visual Studio, or any Microsoft C++ compiler,
    and cannot use MinGW, is there separate public domain program I can run
    to successfully convert *.a files into *.lib files so that the library/ies
    can continue to be linked and accessed to and will function just the same,
    even with the old/original headers?

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Library File Format questions.

    Both .a and .lib files are static libraries.
    Usually on Windows you use .lib, while on Linux/Unix you use .a files.
    This might be an interesting read: https://stackoverflow.com/questions/...-and-def-files

    Why are you not able to use Visual Studio? There is a Visual Studio Community Edition which is free (for up to small teams) and which contains everything you need. It's not crippled like the older Express editions.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Jul 2013
    Posts
    31

    Re: Library File Format questions.

    We don't use Visual Studio due to business and reliance reasons. The express version is only for community software,
    as far as we see. In an employment and programming scenario, and a software product retail (whatsoever) the license
    rules change, and so, legally, does the license price, as far as we see.

    -Are there any appreciable differences, on Windows and within 64 bit, between *.lib and *.a files? What is the format difference?

    -Without Visual Studio, and without MinGW only programs, is there a native Windows public domain utility the (other) people
    can use to convert *.a files to *.lib files, so that they can be linked to and run, with the same headers, as before then?

    -Can you build folders or directories into *.lib or *.a files?

    -How can you use one header to tell between two different classes that have the same
    name, variables and method signatures and return types, but have different internal implementations? Is this a situation
    that can even happen, due to compiler restrictions?
    Last edited by Zachary1234; January 17th, 2019 at 11:07 PM.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Library File Format questions.

    Quote Originally Posted by Zachary1234 View Post
    We don't use Visual Studio due to business and reliance reasons. The express version is only for community software,
    as far as we see.
    The express edition no longer exists. The Community edition replaces the express edition as Marc mentioned. The community edition is not for community software only. Read more: https://visualstudio.microsoft.com/vs/compare/

  5. #5
    Join Date
    Jul 2013
    Posts
    31

    Re: Library File Format questions.

    Well, fair enough I suppose. However the particulars of my other questions remain. Is someone else maybe able to answer them?

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Library File Format questions.

    The question of converting .a to .lib has been asked a lot.
    A quick search on Google reveals quite a few hits: https://www.google.com/search?client...ert+.a+to+.lib
    I don't have the time to read those resources, but in my mind, I think it will be difficult to convert. When you are using static libraries, those static libraries should normally be build with the same compiler and compiler settings as the compiler and compiler settings you are using to build the application that wants to link with the static libraries. This is especially important if your static libraries are using C++ and not only C.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  7. #7
    Join Date
    Jul 2013
    Posts
    31

    Re: Library File Format questions.

    -What about the header/class linking question? Can you have subdirectories and classes in a .lib or .a file, on Windows?

  8. #8
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Library File Format questions.

    I don't think you understand the concept of .lib and .a files.
    These are compiled binaries. They consist of compiled functions, classes, and so on. They do not have some kind of "filesystem" in them with subdirectories and files.
    Maybe this is an interesting read: https://docs.microsoft.com/en-us/cpp...p?view=vs-2017
    Also, if you are talking about embedding resources (files, binary data, images, ...) in a static library .lib file, then that's not really possible. Such resources are added in .exe or .dll files, see also: https://stackoverflow.com/questions/...static-library
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  9. #9
    Join Date
    Jul 2013
    Posts
    31

    Re: Library File Format questions.

    In C++, it is possible, with the correct assistance, to build your own .lib or .a files.

    -Is it forbidden within those formats to submit directories to be included inside either
    of those two formats, or not?

  10. #10
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Library File Format questions.

    What exactly are you trying to achieve?
    What is your use-case?
    The format of Windows .lib files is explained here: https://docs.microsoft.com/en-us/win...ry-file-format
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

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