Add cbindgen infrastructure to auto-generate C/C++ header from Rust extern "C" surface at build time. - Add cbindgen.toml config (C language, include guard, pragma_once, cpp_compat) - Add build.rs to generate include/pdftract.h during cargo build - Generated header compiles cleanly with gcc (C) and g++ (C++) The header is the contract between libpdftract and C/C++ consumers. Future extern "C" functions will automatically appear in the header. Refs: pdftract-5rl5o
1.6 KiB
1.6 KiB
pdftract-5rl5o: cbindgen header generation for pdftract.h
Work Completed
Files Created
-
crates/pdftract-libpdftract/cbindgen.toml
- Configures cbindgen for C header generation
- Language: C
- Include guard:
PDFTRACT_H pragma_onceenabled for modern compilerscpp_compat = truefor C++ compatibility- Export prefix:
pdftract_
-
crates/pdftract-libpdftract/build.rs
- Runs cbindgen at build time
- Reads cbindgen.toml config
- Generates
include/pdftract.hfrom Rust extern "C" surface
-
crates/pdftract-libpdftract/include/pdftract.h
- Auto-generated header file
- Contains include guard + pragma once
- Currently minimal (no extern "C" functions defined yet in lib.rs)
Acceptance Criteria
PASS
cargo build -p pdftract-libpdftractregeneratescrates/pdftract-libpdftract/include/pdftract.h- Generated .h compiles cleanly with
gcc -xc -c -o /dev/null include/pdftract.h - Generated .h compiles cleanly with
g++ -xc++ -c -o /dev/null include/pdftract.h(cpp_compat verified) - Header contains include guard + pragma once
NOTE
- CI gate for header diff check should be added in
jedarden/declarative-config(Argo Workflows CI) - No extern "C" functions exist yet in lib.rs (scaffold only), so header is minimal
- When extern "C" functions are added in sibling beads, they will automatically appear in the header
Header Structure
/* Copyright 2026 Jed Cabanino. MIT OR Apache-2.0 */
#ifndef PDFTRACT_H
#define PDFTRACT_H
#pragma once
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#endif /* PDFTRACT_H */