Skip to content

rust: Port the module load rules in obs-module.c to obs-core #2801

Closed

Description

@rdoupe

Rust port, round 12 unit 2: the module load decisions in libobs/obs-module.c.h, moved to Rust (rust/obs-core, new module module_load_rules, next to module_type_rules, module_source_rules and module_paths).

Unit

libobs/obs-module.c.h → libobs/obs-module-load-rules.c.h → rust/obs-core (module_load_rules).

Phase and position

Phase 6 (core), the next slice of obs-module.c.h after the search paths (#1876), the names (#1915), the source and type registration rules (#1929, #2194). Waits on the core-module reload fix (#2730, landed as #2732).

Scope

Rust takes over these decisions:

  • obs_open_module: the gates (no module pointer, path or core: error; the host skip), the open failure, the exports result, and the version rule (ver() & 0xFFFF0000 above LIBOBS_API_VER is incompatible);
  • load_module_exports: which required export is missing first (obs_module_load, obs_module_set_pointer, obs_module_ver, in that order). C still looks each one up where it does today and asks after each lookup;
  • is_safe_module / is_disabled_module: an empty safe list allows every module, an empty disabled list disables none (the name match is already Rust, obs_module_names_listed);
  • obs_get_module_allow_disable;
  • load_all_callback, the routing: not an OBS plugin, not on the safe list, disabled, a legacy plugin with a core module's name, already loaded (core, legacy and plugin wording), then per open code (missing exports, failed to open with the core-module carry-on, error, incompatible version, host skip), then the init result, and whether a failure is counted;
  • obs_load_core_modules: the cached result, and loaded only when no failure was counted;
  • find_core_module: the core-type refusal;
  • obs_is_core_module, obs_is_legacy_module.

C keeps get_plugin_info, obs_get_module, obs_host_skip_module, os_dlopen, os_dlsym, the ver() call, the module struct setup, obs_create_disabled_module, obs_init_module, free_module, the failure string and its split, load_core_modules, obs_module_paths_find, obs_module_names_find_core, and every log message (same text, level and order). Every read and call stays in its original place and under its original condition: the lookups stop at the first missing export and the routing at the first skip, as today.

Dependencies and existing tests

  • Depends on module_names (obs_module_names_listed, already Rust) and the core-module reload fix (libobs: stop obs_load_core_modules reloading already loaded core modules (#2730) #2732, landed).
  • Existing real-libobs coverage: the module search and load tests from the module_paths, module_names and module_type_rules ports, and test_core_module_load.
  • No characterization of the routing itself yet: test_module_load_steps lands first, pinning every pre-route combination, every open code for a core module and a plugin (an unknown code goes on to init: characterized, not endorsed), the version word (same major and minor with any patch, one minor above, 0xFFFF0000), a missing export at each of the three places, obs_load_core_modules twice after a success and after a failure, a core module that can't be opened, and a NULL fail_info.

Plan

The standard six commits, one PR:

  1. move to libobs/obs-module-load-rules.c.h (behaviour-neutral; the export sets stay identical on the C, hybrid and c-ref builds);
  2. characterization test;
  3. Tier 1 RED;
  4. GREEN in libobs.ported-module-load-rules;
  5. Tier 3 parity (exhaustive over the booleans, types and codes; proptest over u32 version words and list sizes), with a mutation check;
  6. docs.

Notes

No intentional behaviour difference. No SIMD, threading or per-OS code. The MODULE_*, OBS_MODULE_TYPE_* and OBS_MODULE_DISABLED* values are copied into the rules header and _Static_asserted against the core headers in obs-module.c.h.

Activity

  1. added
    port
    ready
    on Oct 28, 2026
  2. rdoupe commented on Oct 28, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2801 (round 12 unit 2).

    1. Move the decisions to libobs/obs-module-load-rules.c.h (behaviour-neutral).
    2. Characterization test test_module_load_steps.
    3. Tier 1 RED against todo!() stubs.
    4. GREEN in libobs.ported-module-load-rules.
    5. Tier 3 parity with a mutation check.
    6. Docs.

    One PR; a draft opens with the RED commit today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

portready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions