1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-12-11 21:13:00 +01:00
C static library for learning purposes. Implement useful functions/data structures while being easier to use than libc (C standard library). https://libcproject.vercel.app/
Go to file
2023-01-07 19:41:04 +01:00
.github fix: exclude release tools in documentation 2023-01-06 18:08:34 +01:00
doxygen-awesome-css@a3c119b479 chore: add doxygen-awesome-css git submodule correctly 2023-01-06 17:42:51 +01:00
lib refactor: include only in header files 2023-01-07 19:41:04 +01:00
test refactor: include only in header files 2023-01-07 19:41:04 +01:00
.clang-format chore: initial commit 2023-01-05 19:28:05 +01:00
.commitlintrc.json chore: add commitlint 2023-01-05 21:18:49 +01:00
.editorconfig feat: first release 2023-01-05 21:13:10 +01:00
.gitattributes feat: first release 2023-01-05 21:13:10 +01:00
.gitignore perf: improve Makefile to only compile changed files 2023-01-06 17:37:50 +01:00
.gitmodules feat: generate documentation 2023-01-06 16:32:29 +01:00
.releaserc.json chore: prepare release correctly 2023-01-05 21:32:24 +01:00
CODE_OF_CONDUCT.md feat: first release 2023-01-05 21:13:10 +01:00
CONTRIBUTING.md feat: first release 2023-01-05 21:13:10 +01:00
Doxyfile chore: minor improvements 2023-01-07 18:57:14 +01:00
DoxygenLayout.xml feat: generate documentation 2023-01-06 16:32:29 +01:00
libcproject.h feat: add array_list data structure 2023-01-07 19:40:16 +01:00
LICENSE chore: initial commit 2023-01-05 19:28:05 +01:00
main.c chore: initial commit 2023-01-05 19:28:05 +01:00
Makefile refactor: include only in header files 2023-01-07 19:41:04 +01:00
README.md chore: minor improvements 2023-01-07 18:57:14 +01:00
set_version.c feat: first release 2023-01-05 21:13:10 +01:00
version.h chore(release): 1.1.2 [skip ci] 2023-01-06 17:09:41 +00:00

libcproject

C static library easier to use than `libc` (C standard library).

Licence MIT Contributor Covenant
Conventional Commits semantic-release

About

libcproject is a C static library for learning purposes. It tries to implement useful functions/data structures while being easier to use than libc (C standard library) as much as possible.

C is a low-level programming language and we often end up reinventing the wheel as the C standard library (libc) is quite small and in my humble opinion, not well designed.

libcproject solve this by providing common functions or data structures (dictionary, linked_list, queue, stack, etc.) we might need in our C projects.

Online documentation.

Prerequisites

For example on GNU/Linux Ubuntu:

sudo apt-get install build-essential gcc make clang-format
sudo apt-get install doxygen doxygen-gui doxygen-doc graphviz

Usage

make # to compile
make run # to run main
make test # to run unit tests
make lint # to lint the code
make documentation # to generate the documentation
make clean # to clean up

nm ./build/libcproject.a # to see the symbols

Steps to create a new C project that uses libcproject:

Step 1: Install and Compile libcproject

# Clone the repository
git clone https://github.com/Divlo/libcproject.git

# Go to libcproject directory
cd libcproject

# Compile the library
make

Step 2: Create a new project

mkdir my-project
cd my-project

Step 3: Install libcproject in the project

mkdir libcproject
cp --recursive <path-to-libcproject> ./ # copy
# or
ln -s <path-to-libcproject> ./ # symbolic link

Step 4: Create a new C file

touch main.c
#include <stdio.h>
#include <stdlib.h>

#include "libcproject/libcproject.h"

int main() {
  char* string = "Hello, world!";
  printf("%s\n", string);
  printf("string_length = %ld\n", string_get_length(string)); // `string_get_length` is a function from `libcproject`
  return EXIT_SUCCESS;
}
gcc -o ./main.exe ./main.c -L. -l:./libcproject/build/libcproject.a

💡 Contributing

Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.

The steps to contribute can be found in the CONTRIBUTING.md file.

📄 License

MIT