Results 1 to 7 of 7

Thread: Using .so libraries under Mac

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Using .so libraries under Mac

    Quote Originally Posted by maverick_pol View Post
    So, just to be 100% sure, I can't use the same .so libs(compiled under linux, on Mac?) ? yes?
    Correct.

    Secondly, ".dylib" are libs on Mac and what about ".a"? Is ".a" also a lib extension? Or, ".dylib" is the only lib ext.?
    .a is a static library ("archive").

  2. The following user says thank you to wysota for this useful post:

    maverick_pol (6th January 2008)

  3. #2
    Join Date
    Jan 2006
    Location
    Socorro, NM, USA
    Posts
    29
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanked 3 Times in 3 Posts

    Default Re: Using .so libraries under Mac

    Quote Originally Posted by wysota View Post
    Correct.



    .a is a static library ("archive").
    Let me give a more detailed explanation since you mentioned you are a newbie.

    .a libraries are files which contain compiled code in an archive format. Under Linux/Unix the program ar is used to create those. Extracting a .a library gives you .o files (compiled files, object files, binary, not executable). Each .o file is the result of a single compilation (which can contain multiple source files) like "gcc -c -o myStuff.o foo.c bar.c". You would link against a .a library libfoo.a if your code shall be self sufficient in respect to code in libfoo.a which means that it should not depend on a library libfoo.so on the platform where your application runs. This can have several reasons. Eittther you are not allowed to distribute the ldynamic version of the library or your company restricts distributed binaries to be single files only. Your application would then contain all the parts (.o files) of libfoo.a which your application needs. GCC takes care of this process when your application is linked together.

    .dylib on MacOS or .so files are libraries which contain essentially the same code which a static library would contain. The difference is that these libraries will be loaded by the system's dynamic library loader as soon as your application is executed. The dynamic library loader checks if your application is linked against certain libraries (at link time you specify -lfoo, really just a place holder) and looks in the dynamic library on the system for methods, functions, classes, variables, etc. which are missing in your application but in the library and makes them available to the application. The benfit is here that multiple applications can reuse the same library. This makes maintenance very easy and saves tons of space.
    There are 10 people in the world. Those who understand binary and those who don't.

  4. The following user says thank you to Thomas for this useful post:

    maverick_pol (6th January 2008)

Similar Threads

  1. Qt + Eclipse + MinGW + Windows: How to include libraries?
    By jambrek in forum General Programming
    Replies: 3
    Last Post: 19th December 2007, 14:57
  2. how to add new libraries to QT
    By whoops.slo in forum Newbie
    Replies: 3
    Last Post: 12th January 2007, 12:15
  3. Qt 3.3 libraries
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2006, 18:25
  4. Standardization on libraries
    By brcain in forum General Discussion
    Replies: 13
    Last Post: 16th August 2006, 23:56
  5. Replies: 4
    Last Post: 7th March 2006, 09:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.