* Problems in writing test apps
@ 2008-04-03 8:59 haoshun
2008-04-03 9:59 ` Matthias Koenig
0 siblings, 1 reply; 2+ messages in thread
From: haoshun @ 2008-04-03 8:59 UTC (permalink / raw)
To: alsa-devel
Hi:
sorry,forget to add the subject right now...
I'm confused by a problem when i modify a test application "alsa-lib-1.0.13/test/control.c".
I wanna use the structure "snd_ctl_elem_value_t",but when i write like this:
snd_ctl_elem_value_t aaa;
there will be an error:
storage size of 'aaa' isn't known
while
snd_ctl_elem_value_t *aaa;
makes no errors. But i can't change it directly such as:
aaa->id=test_id ; //test_id is defined before
cause it will bring an error:
dereferencing pointer to incomplete type
I think i should use the function like "snd_ctl_elem_info_set_id",but i just want to know why,i don't think it disobeys the C syntax.Is there something different in the ALSA making procedure?or Makefile?
haoshun
2008-04-03
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Problems in writing test apps
2008-04-03 8:59 Problems in writing test apps haoshun
@ 2008-04-03 9:59 ` Matthias Koenig
0 siblings, 0 replies; 2+ messages in thread
From: Matthias Koenig @ 2008-04-03 9:59 UTC (permalink / raw)
To: haoshun; +Cc: alsa-devel
"haoshun" <haoshun@amoi.com.cn> writes:
> Hi:
> sorry,forget to add the subject right now...
> I'm confused by a problem when i modify a test application
> "alsa-lib-1.0.13/test/control.c". I wanna use the structure
> "snd_ctl_elem_value_t",but when i write like this:
> snd_ctl_elem_value_t aaa;
> there will be an error:
> storage size of 'aaa' isn't known
> while
> snd_ctl_elem_value_t *aaa;
> makes no errors. But i can't change it directly such as:
> aaa->id=test_id ; //test_id is defined before
> cause it will bring an error:
> dereferencing pointer to incomplete type
> I think i should use the function like
> "snd_ctl_elem_info_set_id",but i just want to know why,i don't
> think it disobeys the C syntax.Is there something different in
> the ALSA making procedure?or Makefile?
The ALSA data types are designed to be opaque. You cannot access the
members of the structures directly as the structure definitions are
simply not exported on purpose. You have to use the access functions.
E.g. allocating a snd_ctl_elem_value_t structure will be done with the
int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr)
Matthias
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-03 9:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-03 8:59 Problems in writing test apps haoshun
2008-04-03 9:59 ` Matthias Koenig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.