'va_list' undeclared (first use in this function)

In my driver, I use 'va_list' type to define variable, but, the compiler reports the following error:
Code:
'va_list' undeclared (first use in this function)
Which header file should I include?

thanks
 
You can't use C library functions (or macros) within the kernel and, as a consequence, in a driver.
 
You can't use C library functions (or macros) within the kernel and, as a consequence, in a driver.

I think that's not true and he's only missing the line:
Code:
#include <machine/stdarg.h>

Because va_list is used all over the drivers- and kernel-code.
 
It might have been defined specifically in the kernel sources but my statement is still true.
 
To clarify: what SirDice probably tries to say (and he's absolutely right about that) is that driver and kernel code should not use userland libraries. However, if (some form of) stdarg is also available in the kernel source tree then it's perfectly fine to use that; just include the right header file and hack away.

Fonz

P.S. If I'm not mistaken, stdarg consists solely of macros, so in this case there shouldn't be any problems as long as one includes the right header file.
 
Back
Top