Nobuyoshi Nakada
7/25/2007 1:00:00 AM
Hi,
At Wed, 25 Jul 2007 03:40:03 +0900,
Phlip wrote in [ruby-talk:261581]:
> > osso_return_t osso_rpc_async_run( osso_context_t*, const gchar*, const gchar*, const gchar*, const gchar* osso_rpc_async_f*, gpointer, int, ... );
> >
> > My question is this, how would I go about binding a function
> > that has varargs? That is, how would I go about calling a C
> > function that has varargs in it's prototype, like 'printf' et
> > al, and the example enough. I'm baffled.
>
> Ask on news:comp.lang.c , because AFAIK there might be a system to
> convert an array into an argument stack. It must naturally port to the
> hardware stack.
No portable way, AFAIK. And even if there is a such way, it
would need va_list version of the function.
> And post more code, so you won't get lifers whining that your question
> dares to mention anything besides raw C. Put in enough code samples
> that someone who didn't know Ruby but did know varargs could help.
> Provide, for example, some reckoning of how Ruby does a raw array.
>
> Another suggestion: Look inside Ruby's source for sprintf.
Which do you mean rb_f_sprintf(), or vsnprintf()?
--
Nobu Nakada