Kombucha Kraze

We tried this mystical solution for the first time two weeks ago at the Palmercare Orthopedics Charity Golf Tournament. Today we figure out what it is and what are the real health benefits? Kombucha…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




C libraries

A library in C is a collection of header files, exposed for use by other programs.

A header file is a file with extension .h which contains C function declarations and macro definitions to be shared between several source files.

Libraries are classified by the type of work they do, there are libraries of entry and exit, mathematics, memory management, text management and how you imagine there are many bookstores available and all with a specific function.

There are two fundamental types of libraries: static and dynamic, that although they share the same generic name “library”, they use different mechanisms to provide their functionality to the executable.

A static library is a library that “copies” into our program when we compile it. Once we have our executable the library will no longer be necessary for our executable to work as it has copy of the functions it need

A dynamic library is NOT copied into our program when compiling. When we have our executable and we are running it, every time the code needs something from the library, it will search for it. If we delete the library, our program will give an error that it cannot find it.

Supose that you have a serie of functions and a headers file in C.

You must pass the .c files to .o and use the following command

gcc: Is compiler of c and c++.

-c: Serves for make a object file.

*:select all “.c” files

When executing this command, all of our .c files in the current directory will be transformed into objects .o

2. The basic tool used to create static libraries is a program called ‘ar’

once we have the .o files we can create the static library and for that we use the command

ar : Is used for make and modified and extract archives, after name of the library with the suffix “*.a”, this is for convention.

-c: The flag is busy to make the library if, it doesn´t exist.

-r: Replace the older object files to new object files.

3. To make sure that the libholberton.a library contains the .files or execute the following command

When you execute the command you will see

to see the symbol of a static library we use the following command

4. After verifying that the .o files are in the library you should index them as the compiler later uses this index to speed up the search for symbols within the library.

for this we use the following command

to use the blibioteca we must use the following command

-l<library name> without prefix or extension.

main.c is the name of the file in which we want to include the library.

Add a comment

Related posts:

To Blog or Not to Blog

Do you have people telling you to write? DO they say that you have a voice and that you have influence and a responsibility to share it? These people aren’t just any people, are they? These people…

A Christmas story written by A.i.

The story below was written using OpenAi’s text generator using the phrase “Tell me a Christmas story” to generate the copy. It was Christmas Eve, and a light snow was falling over the cozy little…

AI Draws famous movie scripts!

I took the description of famous movie characters or scenes directly from the original script into an AI tool. Retirei a descrição de personagens ou cenas de filmes famosos, diretamente do script…