gemini-code-assist[bot] commented on code in PR #591:
URL: https://github.com/apache/tvm-ffi/pull/591#discussion_r3245608586


##########
rust/tvm-ffi/src/macros.rs:
##########
@@ -260,11 +260,22 @@ macro_rules! impl_arg_into_ref {
 macro_rules! tvm_ffi_dll_export_typed_func {
     ($name:ident, $func:expr) => {
         $crate::macros::paste::paste! {
+            // `#[no_mangle]` is required so the symbol is preserved in a
+            // `cdylib` and matches the `__tvm_ffi_<name>` naming convention
+            // that `ffi.Module.load_from_file.<format>` looks up via
+            // `GetSymbolWithSymbolPrefix`. Without it, the linker strips the
+            // function from the output `.so`.
+            //
+            // The path-qualified `$crate::tvm_ffi_sys::…` reference (rather
+            // than a bare `tvm_ffi_sys::…`) lets downstream crates use the
+            // macro without having to add `tvm-ffi-sys` to their own
+            // `[dependencies]`.
+            #[unsafe(no_mangle)]

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   The `#[unsafe(no_mangle)]` attribute is a feature stabilized in Rust 1.82.0. 
Using this syntax will cause compilation errors on older versions of the Rust 
compiler (e.g., 1.80.0 or 1.81.0). Unless the project has explicitly bumped its 
Minimum Supported Rust Version (MSRV) to 1.82.0, it is recommended to use the 
standard `#[no_mangle]` attribute, which is backward-compatible and still valid 
in current Rust versions.
   
   ```suggestion
               #[no_mangle]
   ```



-- 
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