omp_codegen/lib.rs
1//! codgen crate that gives proc macros to generate exported functions and FFI related code automatically
2use proc_macro::TokenStream;
3
4mod entrypoint;
5mod natives;
6
7/// Creates an entry point function for the component to call when it loads
8/// Entry point function is necessary, all the function address is calculated and initialised here
9#[proc_macro_attribute]
10pub fn main(args: TokenStream, input: TokenStream) -> TokenStream {
11 entrypoint::create_main(args, input)
12}
13
14/// Creates a userfunction that calls the native function in component
15/// str - for string data
16/// struct - for open.mp object pointers
17#[proc_macro]
18pub fn native(args: TokenStream) -> TokenStream {
19 natives::create_native(args)
20}