Skip to content

C linux library to easily create modular projects

License

Notifications You must be signed in to change notification settings

digitalsurvival/libmodule

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libmodule

Build Status Codacy Badge Documentation Status License: GPL v3

Libmodule is a C library targeting linux aiming to let developers easily create modular C projects in a way which is both simple and elegant.
You will write less code, focusing on what really matters.

Is this an event loop or an actor lib?

It stands somewhere in the middle, trying to mix the 2 concepts.
It does not provide any faciliting to build an event loop; it does provide its own event loop though.
You may find some/lots of similarities between a libmodule's Module and an Actor.
Indeed, libmodule was heavily inspired by my own actor library experience with akka for its API.

Is it portable?

No, it is not: it uses epoll, which is linux specific.
Moreover it heavily relies upon gcc attributes that may or may not be available for your compiler.
It is tested with both gcc and clang through travis.
Any patch to support other platforms is warmly welcomed though.

Is there any documentation?

Yes, it is availabe at http://libmodule.readthedocs.io/en/latest/.
You have some nice examples too, check Samples folder.

What is a module, anyway?

Unsurprisingly, module is the core concept of libmodule architecture.
It can be somewhat seen as a class, and shares lots of concepts with an Actor.
It helps you to write standard and clean projects with small units, so called modules, whose job should be self-contained.

But...why?

We all know OOP is not a solution to every problem and C is still a beautiful and much used language.
Still, I admit to love code modularity that OOP enforces; moreover, I realized that I was using same code abstractions over and over in my C projects (both side projects and at my job).
So I thought that writing a library to achieve those same abstractions in a cleaner and simpler way was the right thing to do.

Build dep and how to build

You only need cmake to build libmodule; it does not depend upon external software.
Libmodule includes an hashmap implementation provided by Pete Warden (thank you!).
To build, you only need to issue:

$ mkdir build
$ cd build
$ cmake ../
$ make

If you wish to install, then you only need:

# make install

Libmodule will install a pkg-config file too. Use this to link libmodule in your projects, or use "-lmodule" linker flag.
Please note that in order to test examples, there is no need to install the library.

For Archlinux users, a PKGBUILD can be found in Extra/Arch folder.

About

C linux library to easily create modular projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 93.7%
  • CMake 3.5%
  • Shell 2.8%