ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
Platform

Files

file  audio.c
 Audio stubs for WASM (audio not supported in browser environment).
file  log.c
 Logging utility stubs for WASM.
file  video.c
 Video utility stubs for WASM.
file  api.h
 DLL export/import macros for cross-platform symbol visibility.
file  sync.h
 Platform initialization and static synchronization helpers.
file  wasm.h
 WASM browser console logging API.
file  portaudio.h
 Stub PortAudio header for WASM builds.

Data Structures

struct  static_mutex_t
 Static mutex structure for global mutexes requiring static initialization. More...
struct  static_rwlock_t
 Statically initialized mutex wrapper for globals touched during startup. The embedded mutex carries the platform lock and initialized records whether runtime setup has completed; callers use normal mutex operations after initialization. More...
struct  static_cond_t
 Static condition variable structure for global condition variables requiring static initialization. More...

Macros

#define ASCIICHAT_API   __attribute__((visibility("default")))
 Export symbols on Unix platforms (Linux, macOS).
#define STATIC_MUTEX_INIT   {.mutex.impl = PTHREAD_MUTEX_INITIALIZER, .mutex.name = NULL, .initialized = 1}
#define STATIC_RWLOCK_INIT   {.lock.impl = PTHREAD_RWLOCK_INITIALIZER, .lock.name = NULL, .initialized = 1}
#define STATIC_COND_INIT   {.cond.impl = PTHREAD_COND_INITIALIZER, .cond.name = NULL, .initialized = 1}
#define ntohll(x)

Detailed Description

This header defines the ASCIICHAT_API macro used to control symbol visibility in shared libraries (DLLs on Windows, .so/.dylib on Unix).

Windows DLL Behavior:

  • When BUILDING_ASCIICHAT_DLL is defined: exports symbols from the DLL
  • When using the DLL: imports symbols from the DLL
  • Without proper export/import, each module gets its own copy of globals

Unix Behavior:

  • No special handling needed (symbols are visible by default)

Usage:

// In header file (extern declaration):
extern ASCIICHAT_API int global_variable;
extern ASCIICHAT_API void my_function(void);
// In source file (definition):
ASCIICHAT_API int global_variable = 42;
ASCIICHAT_API void my_function(void) { ... }
#define ASCIICHAT_API
Export symbols on Unix platforms (Linux, macOS).
Definition api.h:87

CRITICAL: This header must have ZERO dependencies

  • Do not include any other headers
  • Do not reference any types except built-in C types
  • This allows it to be included first in common.h to avoid circular dependencies
Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
2025

This header provides platform initialization functions and static initialization helpers for synchronization primitives that need to work before main().

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
September 2025

Provides unified network header includes across Windows and POSIX platforms.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Macro Definition Documentation

◆ ASCIICHAT_API

#define ASCIICHAT_API   __attribute__((visibility("default")))

#include <include/ascii-chat/api.h>

Export symbols on Unix platforms (Linux, macOS).

Uses GCC/Clang visibility attributes to explicitly export symbols. This is needed when building with -fvisibility=hidden for better performance and smaller symbol tables.

Definition at line 87 of file api.h.

◆ ntohll

#define ntohll ( x)

#include <include/ascii-chat/network/platform.h>

Value:
htonll(x)

Definition at line 52 of file platform.h.

◆ STATIC_COND_INIT

#define STATIC_COND_INIT   {.cond.impl = PTHREAD_COND_INITIALIZER, .cond.name = NULL, .initialized = 1}

#include <include/ascii-chat/common/sync.h>

Definition at line 139 of file common/sync.h.

◆ STATIC_MUTEX_INIT

#define STATIC_MUTEX_INIT   {.mutex.impl = PTHREAD_MUTEX_INITIALIZER, .mutex.name = NULL, .initialized = 1}

#include <include/ascii-chat/common/sync.h>

Definition at line 137 of file common/sync.h.

◆ STATIC_RWLOCK_INIT

#define STATIC_RWLOCK_INIT   {.lock.impl = PTHREAD_RWLOCK_INITIALIZER, .lock.name = NULL, .initialized = 1}

#include <include/ascii-chat/common/sync.h>

Definition at line 138 of file common/sync.h.