[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please help me understand va_alist

From: Name Surname
Subject: Please help me understand va_alist
Date: Thu, 6 Feb 2020 08:31:30 +0100

Hi everyone,

after several trials and errors I was able to get ffcallback to work. However I 
don't understand how to use va_alist and how to adapt it for my own use case 
beyond the basic examples that I've copy-pasted. Consider this snippet, for 
example, taken from "ffcall/callback/tests.c":

    void i_i_simulator (void* data, va_alist alist)
     {int a = va_arg_int(alist);
      int r=a+1;
      fprintf(out,"int f(int):(%d)",a);
      va_return_int(alist, r);

what do va_start_int and va_return_int do? The manpage has them defined like 

    va_start_type(alist[, return_type]);
    arg = va_arg_type(alist[, arg_type]);
    va_return_type(alist[[, return_type], return_value]);

but what are all those optional return_type/return_value arguments and what are 
they used for?

Finally, what if one of my functions accepts a "struct" as argument insted of 
int? Should I use "va_start_struct_mystruct"?

Thank you for any help!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]