You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, you won't use the Rust binary built. Instead, build the C/C++ library separately using make, cmake, or other tools, and place it accordingly. When targeting OSS libraries, they typically come with make/cmake configurations, so it's best to follow their build procedures to generate the library.
135
139
140
+
bindgen's `default_enum_style` generates consts. When handling in C#, it would be more practical to generate them as enums. Also, csbindgen does not generate consts by default. By enabling `csharp_generate_const_filter`, consts will be generated on the C# side.
141
+
142
+
Additionally, types and enums that exist in the input file are all trimmed and not generated if they are not used in method definitions. If you want to generate types or enums on the C# side, you explicitly specify them using `always_included_types`. For example, `.always_included_types(["ZL_StandardGraphID", "ZL_StandardNodeID"])`.
143
+
136
144
#### C to Rust to C#
137
145
138
146
You can incorporate and build C code into a Rust library by using the [cc crate](https://crates.io/crates/cc) or [cmake crate](https://crates.io/crates/cmake). In that case, you need to create a flow where C# calls Rust, and Rust calls C. You can automate this entire flow by generating both Rust and C# files with `generate_to_file`.
also `csharp_imported_namespaces` can call multiple times.
283
296
297
+
`always_included_types` is optional. Types and enums that exist in the input file are all trimmed and not generated if they are not used in method definitions. If set name, do not trim and generate type to C#.
298
+
284
299
### Unity Callback
285
300
286
301
`csharp_use_function_pointer` configures how generate function pointer. The default is to generate a `delegate*`, but Unity does not support it; setting it to `false` will generate a `Func/Action` that can be used with `MonoPInvokeCallback`.
0 commit comments