LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Whats the deal with libraries? (https://www.linuxquestions.org/questions/linux-newbie-8/whats-the-deal-with-libraries-164850/)

Smaugur [SWE] 04-01-2004 02:27 AM

Whats the deal with libraries?
 
What are the libraries good for ?
:Pengy:

I want to know more about them.:study:

qwijibow 04-01-2004 02:47 AM

libraries hold algorithms....
the thing about computer programs, is they all do the same thing, they put things on your screen, they load and save files, they make noises, they talk to other machines over the internet........

it would be a waste of time if every time a programmer made a program they had to write there own Disk accessing functions !!! and programs would be HUGE.

so, the disk accessing functions are written only once, and saved in a library that any other application can use.

unless you are programming in Assembly, then computer programming is all about writing algorithms, and calling library functions, getting them to do what you want.

Smaugur [SWE] 04-01-2004 05:43 AM

qwijibow Thank you! for refreshing my memory,
So libraries is good to know about if you are a programmer interesting.

stabu 04-01-2004 05:59 AM

good topic
 
Yes thanks qwijibow, good ques, Smaugur.

Next two:

1. are there many cases of libraries for libraries? (I came across a "libglib" once).

2. Are reverse compatibilities respected in library upgrades? It would seem so, due to the convention of renewing symlinks a generic library name to the latest library version. But it would also seem it's a free-for-all sometimes.

Komakino 04-01-2004 06:18 AM

libglib isn't a library for a library, it's just a type library used by gtk. The gtk creators called it glib so the library file that it is stored in is called libglib.

SciYro 04-01-2004 08:57 AM

so libraries are sometimes not binary compatible with other versions? who cares, its called compiling, solves this little problem

devinWhalen 04-01-2004 09:58 AM

When I saw the title for this thread the first thing I thought of was the Seinfield episode where Jerry Seinfield intentionally tries to screw up his stand up comedy routine and starts off with:
"What's the deal with Cancer?"....and gets booed off the stage....hehehehe

Just thought I would share....made my morning ;)

If you don't know what Seinfield is....just carry on...ignore this thread.

Later

P.S.

Sorry for taking up space on a valid and interesting thread with banal information :}

qwijibow 04-02-2004 05:06 AM

its quite impossible to program without using libraries...
take the age old "hello world" program.... (in c++)

#include<iostream>

using namespace std;

int main() {
cout << "Hello world" << endl;
return 0;
}

there you are using a function of the cout (C-out) class in the input / output library to print text to the screen.

stabu 04-02-2004 05:19 AM

library finery
 
Quote:

Originally posted by SciYro
so libraries are sometimes not binary compatible with other versions? who cares, its called compiling, solves this little problem
Could we do a quick rewind and slow-mo over this one? SO there's binary compatibility and source code compatibility then?
Typically, how does the (RE)compilation of the source get over the incompatibilities that the (PRE)compiled display?
This is the newbie forum don't forget.

qwijibow 04-02-2004 09:39 AM

lets say i have some source code.. (called My-Program)
and my program uses a function (called My-Function)
from a library called (My-Library version 1.2)

When i compile my program, it gets linked to My-Library version 1.2
at this linking stage, it looks inside My-Library, and gets the address of the function.

Now.. lets say i give the compiled binary of My-Program to someone who has version 1.1 of My-Library on there machine.... the older library probably still has a function called My-function, but the binary library is different, the function may be at a different address or whatever, anyway, My-Porgram will not reconise My-Library.

However, if instead i gave the other person the source code to My-Prigram, when they compiled it, the linker would link the compiled program to THEIR version of My-Library, which is version 1.1. and will still work.

well... thats a simplified version of what really happens.


All times are GMT -5. The time now is 12:53 PM.