Repository navigation
Expand file tree
/
Copy pathdocs_lib.txt
More file actions
98 lines (78 loc) · 6.09 KB
/
Copy pathdocs_lib.txt
File metadata and controls
98 lines (78 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
┌───────────────────────────────────────────────────────────────┐
│ lib_sup.h - 478b MAGIC! │
├───────────────────────────────────────────────────────────────┤
│ HEADER-ONLY LIBRARY INCLUSION FOR C/C++ - ZERO CONFIG! │
│ • No .a/.so files • No build systems • Pure genius │
└───────────────────────────────────────────────────────────────┘
[1] CONTEXT CREATION:
• C++: Creates inline context (ODR-safe)
> _ls_inline = inline
> _ls_auto_type = auto
• C: Creates static context (unique per TU)
> _ls_inline = static
> _ls_auto_type = __typeof__
[2] COMPILER HACKS:
• #pragma GCC system_header - Treat as system header
• Disables unused warnings (-Wunused-*)
• _ls_dummy variable forces proper context
[3] MSVC SPECIAL:
• CRT initialization section (.CRT$XCU)
• decltype(auto) for type deduction
• Automatic constructor via _ls_init
[4] LIBRARY INCLUSION:
• __LIB_SUB_INCLUDE__(p) - Your custom impl
• Automatically applies fixes to all globals
╔═══════════════════════════════════════════════════════════════╗
║ BASIC USAGE: ║
╚═══════════════════════════════════════════════════════════════╝
+------------------+ +---------------------+ +-------------+
| Your project | | lib_sup.h | | SDL2/ |
| #include "..." | -> | lib_sub_include( | -> | *.h |
| main() { ... } | | "~/dev/SDL2/" | | *.c |
+------------------+ +---------------------+ +-------------+
╔═══════════════════════════════════════════════════════════════╗
║ CODE EXAMPLE: ║
╚═══════════════════════════════════════════════════════════════╝
// main.c
#include "lib_sup.h"
// MAGIC HAPPENS HERE:
lib_sub_include("/path/to/SDL/")
int main() {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* win = SDL_CreateWindow(...);
// Enjoy full SDL without .a files!
}
╔═══════════════════════════════════════════════════════════════╗
║ COMPILATION (GCC/Clang): ║
╚═══════════════════════════════════════════════════════════════╝
gcc -I/path/to/SDL -o game main.c
# No -lSDL2 needed!
╔═══════════════════════════════════════════════════════════════╗
║ COMPILATION (MSVC): ║
╚═══════════════════════════════════════════════════════════════╝
cl /I/path/to/SDL /Fe:game.exe main.c
# No additional libs!
╔═══════════════════════════════════════════════════════════════╗
║ LIMITATIONS: ║
╚═══════════════════════════════════════════════════════════════╝
• Requires C99 or C++17
• Initial compilation may be slower
• Complex macros might need adjustment
• Your __LIB_SUB_INCLUDE__ must handle recursive includes
╔═══════════════════════════════════════════════════════════════╗
║ GENIUS STATS: ║
╚═══════════════════════════════════════════════════════════════╝
+----------------+-----------------------+
| Feature | Value |
+----------------+-----------------------+
| Size | 818 bytes (0.81 KB) |
| Platforms | Windows/Linux/macOS |
| Compilers | GCC, Clang, MSVC |
| Zero deps | ✓ Yes |
| Header-only | ✓ Yes |
| Magic level | ████████████ 100% |
+----------------+-----------------------+
╔═══════════════════════════════════════════════════════════════╗
║ AUTHOR: Denys - [your contacts] ║
║ LICENSE: WTFPL (Do What The Fuck You Want) ║
╚═══════════════════════════════════════════════════════════════╝