Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
module_versioning.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DT_MODULE_VERSION   23
 Version of the module interface every dynamically-loaded module is checked against at load time.
 
#define DT_MODULE(MODVER)
 Instantiate the version handshake every module must export. Use once, at file scope, in each module's main .c file.
 
#define DT_MODULE_INTROSPECTION(MODVER, PARAMSTYPE)   DT_MODULE(MODVER)
 DT_MODULE() for a module whose params struct is introspected.
 

Functions

static int dt_version ()
 The interface version the HOST expects, in the host's own build configuration.
 
char * dt_version_major_minor ()
 The application version, truncated to <major>.<minor>.
 

Macro Definition Documentation

◆ DT_MODULE

#define DT_MODULE (   MODVER)
Value:
{ \
} \
{ \
return MODVER; \
}
int dt_module_dt_version()
int dt_module_mod_version()
#define DT_MODULE_VERSION
Version of the module interface every dynamically-loaded module is checked against at load time.

Instantiate the version handshake every module must export. Use once, at file scope, in each module's main .c file.

This DEFINES two functions – dt_module_dt_version() and dt_module_mod_version() – rather than declaring anything, so it is a definition site, not a header-style annotation: exactly one per shared object.

Parameters
MODVERthe module's OWN parameter version, independent of DT_MODULE_VERSION. Bump it when that module's params struct changes, and provide legacy_params() to migrate old history and presets.
Note
In a _DEBUG build the reported interface version is NEGATED. That is deliberate: debug and release builds lay some shared structs out differently, so a debug module dropped into a release host (or the reverse) reports a version that cannot match and is refused at load, instead of loading and misreading every struct it is handed. If a module mysteriously fails to load, check that it was built in the same configuration as the host before looking anywhere else.

Definition at line 72 of file module_versioning.h.

◆ DT_MODULE_INTROSPECTION

#define DT_MODULE_INTROSPECTION (   MODVER,
  PARAMSTYPE 
)    DT_MODULE(MODVER)

DT_MODULE() for a module whose params struct is introspected.

Parameters
MODVERas for DT_MODULE().
PARAMSTYPEthe params struct type.
Warning
PARAMSTYPE is IGNORED by the preprocessor – this expands to plain DT_MODULE(MODVER). It is read at BUILD time by the introspection generator, which parses the source text and emits the field table into a generated header. Two consequences: the argument must name a type the generator can find by parsing, and a change to that struct's fields or $DEFAULT annotations only takes effect once the generated file is regenerated. A stale generated file compiles cleanly and silently keeps the old defaults.

Definition at line 95 of file module_versioning.h.

◆ DT_MODULE_VERSION

#define DT_MODULE_VERSION   23

Version of the module interface every dynamically-loaded module is checked against at load time.

Warning
Bumping it invalidates EVERY module at once: each one reports this value through DT_MODULE() at the version it was compiled with, and the loader refuses any mismatch. Bump it whenever the layout of a struct crossing the module boundary changes, and do not bump it for anything else. A module .so left over from a previous build that still reports the same number will be loaded and will misread the new layout – silently.

Definition at line 39 of file module_versioning.h.

Function Documentation

◆ dt_version()

static int dt_version ( )
inlinestatic

The interface version the HOST expects, in the host's own build configuration.

Returns
DT_MODULE_VERSION, negated in a _DEBUG build. A module loads only when its dt_module_dt_version() returns the same value.

Definition at line 101 of file module_versioning.h.

References DT_MODULE_VERSION.

◆ dt_version_major_minor()

char * dt_version_major_minor ( )

The application version, truncated to <major>.<minor>.

Returns
a newly-allocated string. The caller owns it and must g_free() it.

Definition at line 314 of file darktable.c.

References darktable_package_string, L, and p.