@@ -74,6 +74,15 @@ pub trait VarcallSignatureTuple: PtrcallSignatureTuple {
74
74
varargs : & [ Variant ] ,
75
75
) -> Self :: Ret ;
76
76
77
+ unsafe fn out_builtin_ptrcall_varargs (
78
+ builtin_fn : BuiltinMethodBind ,
79
+ class_name : & ' static str ,
80
+ method_name : & ' static str ,
81
+ type_ptr : sys:: GDExtensionTypePtr ,
82
+ args : Self :: Params ,
83
+ varargs : & [ Variant ] ,
84
+ ) -> Self :: Ret ;
85
+
77
86
fn format_args ( args : & Self :: Params ) -> String ;
78
87
}
79
88
@@ -303,6 +312,35 @@ macro_rules! impl_varcall_signature_for_tuple {
303
312
result. unwrap_or_else( |err| return_error:: <Self :: Ret >( & call_ctx, err) )
304
313
}
305
314
315
+ #[ inline]
316
+ unsafe fn out_builtin_ptrcall_varargs(
317
+ builtin_fn: BuiltinMethodBind ,
318
+ class_name: & ' static str ,
319
+ method_name: & ' static str ,
320
+ type_ptr: sys:: GDExtensionTypePtr ,
321
+ ( $( $pn, ) * ) : Self :: Params ,
322
+ varargs: & [ Variant ] ,
323
+ ) -> Self :: Ret {
324
+ let call_ctx = CallContext :: outbound( class_name, method_name) ;
325
+ //$crate::out!("out_builtin_ptrcall_varargs: {call_ctx}");
326
+
327
+ let explicit_args: [ Variant ; $PARAM_COUNT] = [
328
+ $(
329
+ into_ffi_variant( & $pn) ,
330
+ ) *
331
+ ] ;
332
+
333
+ let mut type_ptrs = Vec :: with_capacity( explicit_args. len( ) + varargs. len( ) ) ;
334
+ type_ptrs. extend( explicit_args. iter( ) . map( sys:: GodotFfi :: sys) ) ;
335
+ type_ptrs. extend( varargs. iter( ) . map( sys:: GodotFfi :: sys) ) ;
336
+
337
+ // Important: this calls from_sys_init_default().
338
+ let result = new_from_ptrcall:: <Self :: Ret >( |return_ptr| {
339
+ builtin_fn( type_ptr, type_ptrs. as_ptr( ) , return_ptr, type_ptrs. len( ) as i32 ) ;
340
+ } ) ;
341
+ result. unwrap_or_else( |err| return_error:: <Self :: Ret >( & call_ctx, err) )
342
+ }
343
+
306
344
#[ inline]
307
345
fn format_args( args: & Self :: Params ) -> String {
308
346
let mut string = String :: new( ) ;
0 commit comments