Skip to content

Experiment/cpp26 reflection ffi#20

Open
Katze719 wants to merge 15 commits into
mainfrom
experiment/cpp26-reflection-ffi
Open

Experiment/cpp26 reflection ffi#20
Katze719 wants to merge 15 commits into
mainfrom
experiment/cpp26-reflection-ffi

Conversation

@Katze719

@Katze719 Katze719 commented Jun 6, 2026

Copy link
Copy Markdown
Member

No description provided.

@Katze719 Katze719 force-pushed the experiment/cpp26-reflection-ffi branch from 5a55a06 to 6612335 Compare June 6, 2026 22:16
@Katze719 Katze719 force-pushed the experiment/cpp26-reflection-ffi branch from 6612335 to df120eb Compare June 6, 2026 22:18
@Katze719 Katze719 force-pushed the experiment/cpp26-reflection-ffi branch from df120eb to 83e6c24 Compare June 6, 2026 22:37
@Katze719 Katze719 force-pushed the experiment/cpp26-reflection-ffi branch 2 times, most recently from 0643140 to 9336e26 Compare June 8, 2026 20:25
@Katze719 Katze719 marked this pull request as ready for review June 10, 2026 20:18
@Katze719 Katze719 requested a review from Mqxx June 10, 2026 20:18
Comment thread .github/workflows/build_compile_tests_and_bindgen_smoke.yml
Comment thread .github/workflows/doxygen.yml Outdated
Comment thread .github/workflows/build_compile_tests_and_bindgen_smoke.yml Outdated
Comment thread cmake/mingw-toolchain.cmake
* @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),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this function do? Or what is this function for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this file for?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/ffi_metadata.test.cpp
Comment thread tests/status_code.test.cpp
"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"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there only the serialOpen function?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tools/generate_deno_symbols.cpp Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants