This repository contains a custom C library, Libft, implemented as part of a coding project.
The objective of the project is to create a static library (.a
file) in C that reimplements many of the standard library functions, as well as additional useful functions.
A static library is a collection of object files that are linked directly into the final executable at compile time.
The goal is to gain a deeper understanding of how these functions work internally and to provide a versatile library that can be reused in future C projects without relying on external dependencies.
The mandatory part of the project involves reimplementing several standard C library functions.
These functions are divided into different subcategories, depending on their purpose.
The primary categories are Libc functions (reimplementations of standard C library functions) and Additional functions (new utility functions added to complement the library).
Within these categories, the functions can be further grouped based on their operations on strings, memory, utility functions, and linked lists.
For detailed documentation, including usage examples and function breakdowns, please visit the link below:
To clone this repository and compile the project, run the following commands:
git clone https://github.com/pin3dev/42_Libft.git
cd 42_Libft/libft
This will download the project from GitHub into your local machine in current directory. Once inside the libft
directory, you must run make to compile the library.
A Makefile
is provided to automate the compilation process. The Makefile includes the following rules:
all
: Compiles the library (libft.a
).clean
: Removes object files.fclean
: Removes object files and the library (libft.a
).re
: Recompiles the entire project.bonus
: Compiles the bonus part of the project.test
: Compiles the bonus part and runs the test written by @alelievr
To compile the library, simply run:
make
This will generate the libft.a
library, which can be linked in other projects to use all functions.
To use the libft library in your C code, follow the steps below:
-
Include the header in your code:
#include "libft/inc/libft.h"
-
Compile your code with the library:
gcc -Wall -Wextra -Werror -o your_exec your_code.c 42_Libft/libft/libft.a
-
You can now use any
libft
function in your program now!
This project strictly follows the 42 School Norm coding guidelines, which significantly influenced certain decisions in its implementation. These rules may sometimes lead to seemingly inefficient or unusual solutions, but they were necessary to meet the strict requirements of the school.
All the theoretical material used to develop this project is organized and can be accessed directly via the link below: