Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_module.c File Reference

Load a shared library at runtime and find its symbols. More...

#include <stdio.h>
#include <string.h>
#include "nilorea/n_module.h"
#include <dlfcn.h>
Include dependency graph for n_module.c:

Go to the source code of this file.

Data Structures

struct  N_MODULE
 an opened shared library More...

Functions

static void _n_module_set_error (const char *what, const char *subject)
 helper: record why what failed on subject, in the system's words
int n_module_close (N_MODULE **module)
 Close a library and free its handle.
const char * n_module_error (void)
 What the system said about this thread's last failed call.
const char * n_module_extension (void)
 The file extension shared libraries have on this platform.
N_MODULE * n_module_open (const char *path)
 Open a shared library.
void * n_module_symbol (N_MODULE *module, const char *name)
 Find a symbol in an opened library.

Variables

static __thread char _n_module_last_error [512] = ""
 the last failure on this thread, as the system worded it

Detailed Description

Load a shared library at runtime and find its symbols.

Author
Castagnier Mickael
Version
1.0
Date
24/09/2026

Definition in file n_module.c.


Data Structure Documentation

◆ N_MODULE

struct N_MODULE

an opened shared library

an opened shared library.

Opaque: make it with n_module_open(), release it with n_module_close().

Examples
ex_module.c.

Definition at line 40 of file n_module.c.

Collaboration diagram for N_MODULE:
Data Fields
void * handle dlopen handle, or HMODULE

Function Documentation

◆ _n_module_set_error()

void _n_module_set_error ( const char * what,
const char * subject )
static

helper: record why what failed on subject, in the system's words

Definition at line 49 of file n_module.c.

References _n_module_last_error, LOG_DEBUG, n_log, and N_MODULE_ERROR_MAX.

Referenced by n_module_close(), n_module_open(), and n_module_symbol().

Here is the caller graph for this function:

Variable Documentation

◆ _n_module_last_error

__thread char _n_module_last_error[512] = ""
static

the last failure on this thread, as the system worded it

Definition at line 46 of file n_module.c.

Referenced by _n_module_set_error(), n_module_error(), n_module_open(), and n_module_symbol().