Set of tools including the most important syscall wrappers, library functions, and containers for creating a static standalone (freestanding) application - without libc / libstdc++ dependencies.
Simply run
make
to create the static library libdlh.a.
This library allows building a simple hello world example in file foo.cpp with the content
#include <dlh/stream/output.hpp>
int main() {
cout << "Hallo Welt!" << endl;
return 0;
}
by running
g++ -nodefaultlibs -nostdlib -nostdinc -I include -L. -ldlh -lgcc -o foo foo.cpp
Disabling additional language features with -fno-exceptions, -fno-stack-protector, and -mno-red-zone is recommended.
In addition, libgcc should be included by adding -lgcc.
By default, the legacy interface is omitted, e.g. due to the hiccup caused by the thread local errno variable, flat namespace for functions, etc...
But in case you prefer a more similar interface to basic functions of libc/STL, compile DLH in LEGACY mode:
make LEGACY=1
and include the legacy folder in your project.
For example, a file bar.cpp with the contents
#include <iostream>
int main() {
std::cout << "Hallo Welt!" << std::endl;
return 0;
}
can be compiled using
g++ -nodefaultlibs -nostdlib -nostdinc -I include -I legacy -L. -ldlh -o bar bar.cpp
However, this still does not necessarily provide the same interface or all the functionality of their namesakes.
This project has a strong dependency on the compiler. Only certain features and platforms are supported. It is not intended for general-purpose use.
Dirty Little Helper (DLH) is part of the Luci-project, which is being developed by Bernhard Heinloth of the Department of Computer Science 4 at Friedrich-Alexander-Universität Erlangen-Nürnberg and is available under the GNU Affero General Public License, Version 3 (AGPL v3).
Some files are borrowed from other projects:
- buddy allocator by Evan Wallace (MIT license)
- qsort by Valentin Ochs and Rich Felker from musl libc (MIT license)
Furthermore, the libc interface (especially system calls and their types) was strongly influenced by the GNU C library (glibc) and musl libc, hence certain methods might be very similar or identical.