Experiment/cpp26 reflection ffi#20
Conversation
5a55a06 to
6612335
Compare
6612335 to
df120eb
Compare
df120eb to
83e6c24
Compare
…h new ABI function registry and status code descriptors
0643140 to
9336e26
Compare
| * @param error_callback [optional] Callback to invoke on error. Defined in error_callback.h. Default is `nullptr`. | ||
| * @return 0 on success or a negative error code from ::cpp_core::StatusCode on error. | ||
| */ | ||
| MODULE_API auto serialMonitorPorts(void (*callback_fn)(int event, const char *port), |
There was a problem hiding this comment.
What does this function do? Or what is this function for?
There was a problem hiding this comment.
It is the API for subscribing to serial port attach/detach notifications. Passing a callback starts monitoring and reports port events (event = 1for attach,event = 0for detach); passingnullptr stops monitoring again.
There was a problem hiding this comment.
ffi_metadata is the reflection-backed metadata layer for the public C ABI. It is the source of truth the bindgen tooling uses to discover exported functions, parameter names/types, result models, status codes, and shared struct layouts, so we do not have to duplicate that information manually in each binding target.
| "export type ErrorCallback = (error_code: number, message: string | null) => void;" | ||
| "export function createErrorCallback(callback: ErrorCallback): Deno.UnsafeCallback<typeof errorCallbackDefinition>" | ||
| "export function createBindings(dylib: BindgenLibrary)" | ||
| "serialOpen(port: string | Deno.PointerValue, baudrate: number, data_bits: number, parity: number = 0, stop_bits: number = 0, error_callback: Deno.PointerValue | null = null): bigint" |
There was a problem hiding this comment.
Why is there only the serialOpen function?
There was a problem hiding this comment.
It is just a smoke test, not a full per-symbol golden test. serialOpenwas picked because it exercises most of the generator surface in one function: strings, optional params, callbacks, and handle return values. There are also a few additional checks for other representative outputs likeserialClose, serialInBytesTotal, and the generated helper exports.
No description provided.