Skip to content

Commit d0b1344

Browse files
committed
fix: wrap static function serialization
1 parent 720293e commit d0b1344

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

bindgen/codegen/serialize.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,16 @@ impl<'a> CSerialize<'a> for Function {
7979

8080
assert!(!signature.is_variadic());
8181

82-
let name = self.name();
82+
// Get the function name + namespace
83+
let name = {
84+
let path = item.path_for_allowlisting(ctx).clone();
85+
if path.get(0).is_some_and(|part| part == "root") {
86+
&path[1..]
87+
} else {
88+
&path[..]
89+
}
90+
.join("::")
91+
};
8392

8493
// Function arguments stored as `(name, type_id)` tuples.
8594
let args = {
@@ -114,7 +123,11 @@ impl<'a> CSerialize<'a> for Function {
114123
};
115124

116125
// The name used for the wrapper self.
117-
let wrap_name = format!("{name}{}", ctx.wrap_static_fns_suffix());
126+
let wrap_name = format!(
127+
"{}{}",
128+
item.canonical_name(ctx),
129+
ctx.wrap_static_fns_suffix()
130+
);
118131

119132
// The function's return type
120133
let (ret_item, ret_ty) = {

0 commit comments

Comments
 (0)