I need to pass a pointer like so
extern int Si4709_dev_chan_get(__u32 *);
but gcc complaints about missing brackets.
Si4709_dev.h:130: error开发者_开发百科: expected ‘)’ before ‘*’ token
any ideas on what I can do?
-Earlence
Maybe you need to include the header that contains the typedef
for __u32, this is usually <asm/types.h>
or <sys/types.h>
.
In anycase they shouldn't be portable, you should rely on something that is more likely to be portable like uint32_t
which should be standard for C99 conform implementations (and it should be in stdint.h
.
This is an old, probably dead, question, but there seems to be some confusion to what __u32 actually is, but at least in 3.16.1, which is what I'm looking at right now, __u32 is defined in ./include/uapi/asm-generic/int-ll64.h thusly:
typedef unsigned int __u32;
So, it's simply an unsigned integer.
otherwise, your syntax is wrong, since this is a function definition, you need to name the pointer something to reference it within the function:
extern int Si4709_dev_chan_get(__u32 *x);
Otherwise, see this for more.
http://en.wikipedia.org/wiki/Pointer_%28computer_programming%29#Pass-by-address_using_pointers
精彩评论