1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2024-07-06 18:40:11 +02: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
2024-01-30 01:25:17 +01:00
.github build(deps): update latest 2023-12-26 19:42:12 +01:00
doxygen-awesome-css@df88fe4fdd build(deps): update latest 2023-12-26 19:42:12 +01:00
lib feat: add string_last_position_of 2023-12-26 20:40:46 +01:00
test feat: add string_last_position_of 2023-12-26 20:40:46 +01:00
.clang-format chore: better Prettier config for easier reviews 2023-10-23 23:02:29 +02: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 chore: update @since version 2023-08-05 15:03:53 +02:00
.gitmodules feat: generate documentation 2023-01-06 16:32:29 +01:00
.releaserc.json chore: remove .exe file extension to be more "linux way" 2023-06-25 20:17:28 +02:00
CODE_OF_CONDUCT.md fix: update author - Théo LUDWIG 2023-06-24 20:29:30 +02:00
CONTRIBUTING.md docs: fix doxygen warnings 2023-06-25 21:32:16 +02:00
Doxyfile build(deps): update latest 2023-12-26 19:42:12 +01:00
DoxygenLayout.xml feat: generate documentation 2023-01-06 16:32:29 +01:00
libcproject.h feat!: remove dictionary data structure 2023-06-25 20:09:07 +02:00
LICENSE docs(license): add email address 2024-01-30 01:25:17 +01:00
main.c perf: mutate strings instead of copy when possible 2023-08-06 23:17:07 +02:00
Makefile perf: mutate destination string for string_concatenate 2023-08-07 00:42:11 +02:00
README.md build(deps): update latest 2023-12-26 19:42:12 +01:00
set_version.c refactor: avoid usage of char*, instead use string_t 2023-08-10 00:32:49 +02:00
version.h chore(release): 4.2.1 [skip ci] 2023-12-26 20:20:38 +00:00

libcproject

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

Contributing Licence MIT Contributor Covenant
CI 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 (hash_map, array_list, linked_list, queue, stack, etc.), we might need in our C projects.

Online documentation.

Prerequisites

For example on GNU/Linux Ubuntu:

# Install Build Tools
sudo apt install build-essential gcc make clang-format

# Install Documentation Tools
sudo apt 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: Create a new project

mkdir my-project
cd my-project

Step 2: Install and Compile libcproject in the project

# Clone the repository
git clone git@github.com:theoludwig/libcproject.git

# Go to libcproject directory
cd libcproject

# Compile the library
make

Step 3: Create a new C file

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

#include "libcproject/libcproject.h"

int main() {
  string_t string = "Hello, world!"; // `string_t` is a typedef from `libcproject`
  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 ./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