ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
version.c
Go to the documentation of this file.
1
7#include "version.h"
8
9// GCC/Clang: Use __attribute__((section)) to place string in custom section
10// ELF (Linux): .section_name format
11// Mach-O (macOS): __SEGMENT,__section format
12#if defined(__GNUC__) || defined(__clang__)
13
14#if defined(__APPLE__)
15// macOS Mach-O format: use __TEXT segment for read-only data
16__attribute__((used, section("__TEXT,__ascii_chat"))) const char ascii_chat_custom_section[] =
17 ASCII_CHAT_DOT_ASCII_CHAT_STRING;
18__attribute__((used, section("__TEXT,__comment"))) const char ascii_chat_comment_string[] =
19 ASCII_CHAT_DOT_COMMENT_STRING;
20__attribute__((used, section("__TEXT,__version"))) const char ascii_chat_version_string[] = ASCII_CHAT_VERSION_FULL;
21#define ASCII_CHAT_VERSION_GETTERS
22
23#elif defined(__linux__)
24// Linux ELF format: standard .section_name format
25__attribute__((used, section(".ascii_chat"))) const char ascii_chat_custom_section[] = ASCII_CHAT_DOT_ASCII_CHAT_STRING;
26__attribute__((used, section(".comment"))) const char ascii_chat_comment_string[] = ASCII_CHAT_DOT_COMMENT_STRING;
27__attribute__((used, section(".version"))) const char ascii_chat_version_string[] = ASCII_CHAT_VERSION_FULL;
28#define ASCII_CHAT_VERSION_GETTERS
29#endif
30
31#ifdef ASCII_CHAT_VERSION_GETTERS
32// Provide functions to get version info at runtime
33const char *ascii_chat_get_version(void) {
34 return ascii_chat_version_string;
35}
36const char *ascii_chat_get_comment(void) {
37 return ascii_chat_comment_string;
38}
39#endif
40
41#endif
RGB pixel structure.
Definition video/image.h:80