Thread: Shared, import & static libraries

  1. #1
    Registered User
    Join Date
    Jun 2016
    Posts
    6

    Question Shared, import & static libraries

    Hi forum,

    Can Linux shared/static link libraries be used for Android without change?
    Are import libraries necessary on Linux and Android at all?
    In which folders have libraries to be on Linux/Android at runtime to link properly with them?

    C. C.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by C. C. View Post
    Can Linux shared/static link libraries be used for Android without change?
    If they are for the correct architecture (ARM/ARM64/x86/x64), if they are compatible with the version of linux that the particular Android instance is based on, I see no reason why not.

    Quote Originally Posted by C. C. View Post
    Are import libraries necessary on Linux and Android at all?
    It depends on what you mean by "import libraries."

    Quote Originally Posted by C. C. View Post
    In which folders have libraries to be on Linux/Android at runtime to link properly with them?
    Shared libraries are most often in /usr/lib on most Unix-like systems. On Android, they're often packaged with an app, and not necessarily installed into system locations.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    Registered User
    Join Date
    Jun 2016
    Posts
    6
    Hi,

    with import libraries I mean import libraries for dynamic link libraries like on Windows (.dll/ .dll.a).

    I have used a C compiler app for Android (CPPDroid) and it links successfully with a shared object liballegro-debug.so at compile time and also then complains at runtime that it can not find that library (.so) once more.
    It seems it wants the library two times, at compile time and at run time.

    C. C.
    Last edited by C. C.; 07-01-2016 at 11:45 AM.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by C. C. View Post
    with import libraries I mean import libraries for dynamic link libraries like on Windows (.dll/ .dll.a).
    Linux doesn't use them. An ELF (the binary format on Linux) shared object functions as the static import library and the runtime dynamically linked library.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    Registered User
    Join Date
    Jun 2016
    Posts
    6
    Is 'ELF' also the executable format of Android?

    I don't know exactly what is meant with 'ELF shared object'...
    Do exist .elf AND .elf.so?

    Sorry, but I know very little about Linux and Android...

    C. C.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by C. C. View Post
    Is 'ELF' also the executable format of Android?
    Android is Linux, so the answer is "probably."

    Quote Originally Posted by C. C. View Post
    I don't know exactly what is meant with 'ELF shared object'...
    Do exist .elf AND .elf.so?
    These are things you need to learn, if you expect to work with this sort of files.

    Quote Originally Posted by C. C. View Post
    Sorry, but I know very little about Linux and Android...
    Google is an excellent source of information on the subject. You can literally ask it questions, like "how do dynamic libraries work on linux?"
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  7. #7
    Registered User
    Join Date
    Jul 2016
    Location
    Navi Mumbai
    Posts
    2
    Static libraries do not link with other static libraries. The only way to do this is to use your librarian/archiver tool on Linux to create a single new static library by concatenating the multiple libraries.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 02-04-2014, 06:03 AM
  2. Shared libraries
    By Aslaville in forum C++ Programming
    Replies: 3
    Last Post: 01-26-2013, 07:14 AM
  3. GCC: Compiling with both static and shared libraries
    By eatwithaspork in forum C Programming
    Replies: 4
    Last Post: 06-23-2008, 01:48 PM
  4. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  5. shared libraries
    By Raven Arkadon in forum C++ Programming
    Replies: 5
    Last Post: 06-27-2005, 07:11 AM

Tags for this Thread