-
Notifications
You must be signed in to change notification settings - Fork 0
Embedded Headers
madc includes 40+ standard C/POSIX headers baked into the binary. No external header files needed at runtime.
#include <stdio.h> // angle brackets check embedded headers first
#include <math.h>
#include <string.h>
#include <iostream>Standard I/O constants and functions:
#include <stdio.h>
int main() {
printf("Hello %s, you are %d years old\n", "Alice", 30);
return 0;
}Constants: EOF, SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ, NULL
Auto-loads libm. Provides math constants and functions:
#include <math.h>
int main() {
double x = sqrt(16.0); // 4.0
double y = pow(2.0, 10.0); // 1024.0
double z = sin(M_PI / 2); // 1.0
return 0;
}Constants: M_PI, M_E, M_SQRT2, INFINITY, HUGE_VAL, and more.
Functions: sqrt, sin, cos, tan, pow, exp, log, floor, ceil, round, fabs, fmod, hypot, and more.
C++ streams:
#include <iostream>
int main() {
cout << "Hello, world!" << endl;
string name;
cin >> name;
return 0;
}Registers cout, cin, cerr, endl via lazy initialization.
Header files in include/madc/ are converted to C++ string literals at build time by scripts/gen_embedded_headers.sh. They're compiled into the madc binary — no filesystem lookup needed.
When you #include <header.h>, madc checks embedded headers first. Constants are processed via #define. Functions are available through the dlsym fallback — any function in a loaded shared library (libc is always loaded, libm after #include <math.h>) is callable without explicit registration.
Headers include standard C (stdio.h, stdlib.h, string.h, math.h, ctype.h, time.h, errno.h, etc.), POSIX (unistd.h, fcntl.h, sys/stat.h, sys/file.h, dirent.h, etc.), and C++ (iostream).
-
Preprocessor —
#define,#ifdef,#include,#load - C23 Features — modern C standard coverage
- ← Back to Home