-
Notifications
You must be signed in to change notification settings - Fork 608
feat: add lean_setup_libuv
for initializing required LIBUV components
#8636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Mathlib CI status (docs):
|
This presumably makes progress on #5819 ? |
Not exactly, LibUV provides some functions like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FFI changes LGTM except for the documentation comments. I didn't check the compiler changes.
```c | ||
void lean_initialize_runtime_module(); | ||
void lean_initialize(); | ||
lean_object * initialize_A_B(uint8_t builtin, lean_object *); | ||
lean_object * initialize_C(uint8_t builtin, lean_object *); | ||
... | ||
|
||
lean_setup_libuv(argc, argv); // if using process-related functionality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lean_setup_libuv(argc, argv); // if using process-related functionality | |
argv = lean_setup_libuv(argc, argv); // if using process-related functionality |
@@ -131,14 +131,19 @@ Thus `[init]` functions are run iff their module is imported, regardless of whet | |||
|
|||
The initializer for module `A.B` is called `initialize_A_B` and will automatically initialize any imported modules. | |||
Module initializers are idempotent (when run with the same `builtin` flag), but not thread-safe. | |||
|
|||
**Important for process-related functionality**: If your application needs to use process-related functions from libuv, you must call `lean_setup_libuv(argc, argv)` before calling `lean_initialize()` or `lean_initialize_runtime_module()`. This ensures that libuv's process handling capabilities are properly configured with the command-line arguments, which is essential for certain system-level operations that Lean's runtime may depend on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to mention that users should replace their argv
with the one returned by lean_setup_libuv
.
This PR adds a function called
lean_setup_libuv
that initializes required LIBUV components. It needs to be outside oflean_initialize_runtime_module
because it requiresargv
andargc
to work correctly.