Files
fil/docs/snippets/c/plugins/extractor_registration.md
Henrik Jess Nielsen b4c07d3693
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s
Nomad changes
2026-06-01 23:40:55 +02:00

813 B

#include <kreuzberg.h>
#include <stdio.h>

/*
 * The kreuzberg C FFI does not expose a public function for registering
 * custom DocumentExtractor implementations from C. Document extractors must
 * be registered from Rust via `kreuzberg::plugins::registry::get_document_extractor_registry()`
 * before the C library is loaded.
 *
 * From C you can inspect which extractors the core has registered:
 */

int main(void) {
    char *json = kreuzberg_list_document_extractors();
    if (!json) {
        fprintf(stderr, "list document extractors failed (code %d): %s\n",
                kreuzberg_last_error_code(),
                kreuzberg_last_error_context());
        return 1;
    }

    printf("Registered document extractors: %s\n", json);
    kreuzberg_free_string(json);
    return 0;
}