#ifndef NYRT_H
#define NYRT_H

#ifdef __cplusplus
extern "C" {
#endif

// Phase 20.36/20.37: C‑ABI scaffold (PoC)
// Minimal kernel API for Rust runtime; subject to evolution.

// Initialize NyRT kernel. Returns 0 on success.
int nyrt_init(void);

// Tear down NyRT kernel.
void nyrt_teardown(void);

// Load MIR(JSON v1) text. Returns a handle (>=1) or 0 on error.
unsigned long nyrt_load_mir_json(const char* json_text);

// Execute main() of the loaded module. Returns process‑like rc (0..255).
int nyrt_exec_main(unsigned long module_handle);

// Hostcall bridge (name = "env.*" / provider). Returns 0 on success.
int nyrt_hostcall(const char* name, const char* method,
                  const char* payload_json,
                  /*out*/ char* out_buf, unsigned int out_buf_len);

#ifdef __cplusplus
}
#endif

#endif // NYRT_H

