|
Loom C API
Public Loom compiler C API
|
Optional native C/C++ source import into ordinary Loom modules. More...
Go to the source code of this file.
Data Structures | |
| struct | loomc_cxx_source_provider_t |
| Optional source provider replacing filesystem include reads. More... | |
| struct | loomc_cxx_define_t |
| Preprocessor definition applied after the frontend's predefined macros. More... | |
| struct | loomc_cxx_import_options_t |
| Configuration for one source translation unit. More... | |
Typedefs | |
| typedef uint32_t | loomc_cxx_import_flags_t |
| Bitmask of loomc_cxx_import_flag_bits_t values. | |
| typedef loomc_status_t(* | loomc_cxx_source_provider_fn_t) (void *user_data, loomc_string_view_t path, loomc_source_t **out_source) |
| Resolves a candidate include path to immutable source bytes. | |
Enumerations | |
| enum | loomc_cxx_data_model_t { LOOMC_CXX_DATA_MODEL_LP64 = 0 , LOOMC_CXX_DATA_MODEL_LLP64 = 1 , LOOMC_CXX_DATA_MODEL_ILP32 = 2 } |
| Source integer and pointer layout, independent of the importing process. More... | |
| enum | loomc_cxx_import_flag_bits_t { LOOMC_CXX_IMPORT_FLAG_APPROXIMATE_FUNCTIONS = 1u << 0 , LOOMC_CXX_IMPORT_FLAG_NO_BUILTIN_INCLUDES = 1u << 1 } |
| Explicit source permissions and include delivery policy. More... | |
Functions | |
| loomc_status_t | loomc_module_import_cxx (loomc_context_t *context, loomc_workspace_t *workspace, const loomc_source_t *source, const loomc_cxx_import_options_t *options, loomc_allocator_t allocator, loomc_module_t **out_module, loomc_result_t **out_result) |
| Imports C/C++ source into a verified High IR module, without cleanup passes. | |
Optional native C/C++ source import into ordinary Loom modules.
One configured translation unit produces one compilation-unit module. Multiple kernels and ordinary functions share the module. Build scheduling, host/device partitioning, and linking remain above this interface.
The implementation uses the standalone cxx frontend and native Loom APIs; no LLVM or Python runtime is required. Enable the cxx importer package when building the library and link the optional import/cxx component.
| typedef loomc_status_t(* loomc_cxx_source_provider_fn_t) (void *user_data, loomc_string_view_t path, loomc_source_t **out_source) |
Resolves a candidate include path to immutable source bytes.
Paths follow ordinary quote, user, system, and include_next search rules. Candidate paths use generic '/' separators on every host. Return OK with a NULL output for a missing candidate. Other failures return status with a NULL output. A found source uses UNKNOWN format; its contents supply the header and the candidate path determines include identity.
| user_data | Caller state from the provider descriptor. |
| path | Candidate path borrowed for this callback. |
| out_source | Receives one retained source or NULL for a missing path. |
| loomc_status_t loomc_module_import_cxx | ( | loomc_context_t * | context, |
| loomc_workspace_t * | workspace, | ||
| const loomc_source_t * | source, | ||
| const loomc_cxx_import_options_t * | options, | ||
| loomc_allocator_t | allocator, | ||
| loomc_module_t ** | out_module, | ||
| loomc_result_t ** | out_result ) |
Imports C/C++ source into a verified High IR module, without cleanup passes.
| context | Immutable context containing the core dialects. |
| workspace | Workspace backing the returned module's arena storage. |
| source | Source with UNKNOWN format. Its identifier labels diagnostics and supplies the main file's path for quoted include lookup. |
| options | Source configuration, or NULL for defaults. |
| allocator | Host allocator for public handles and temporary adapters. |
| out_module | Receives one owned module on successful source admission. |
| out_result | Receives one owned result with retained diagnostics. |