junrushao commented on code in PR #331:
URL: https://github.com/apache/tvm-ffi/pull/331#discussion_r2611725004


##########
include/tvm/ffi/extra/module.h:
##########
@@ -176,6 +176,22 @@ class TVM_FFI_EXTRA_CXX_API ModuleObj : public Object {
    * \note Note the signature is not part of the public API.
    */
   const Array<Any>& imports() const { return this->imports_; }
+  /*!
+   * \brief For unloadable libraries, if `keep_alive` is set to true, the 
library will not be
+   * unloaded in its destructor; otherwise, it will be unloaded when the 
library is destructed.
+   * \param keep_alive Whether to keep the library alive.
+   * \note This function is a no-op for libraries that do not support 
unloading.
+   * \sa Close
+   */
+  virtual void SetKeepAlive(bool keep_alive) {}

Review Comment:
   > alternatively, we can expose a function specifically for DSO module
   
   I don't know if we could do this, because we will need to make sure the 
`Module` being passed in is a `LibraryModuleObj` (defined in 
`library_module.cc`), which has a `Library` (defined in `module_internal.h`), 
which is a `DSOLibrary` (defined in `library_module_dynamic_lib.cc`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to