> > register_sample_file_type("mp3",
load_mp3, NULL);
> > register_sample_file_type("ogg",
load_ogg, NULL);
> >
> > So as you can see here, the function
register_sample_file_type() can be
> > called with *several* different callbacks, in this
example the correct
> > callback will be called according to the file type
when the user calls
> > load_sample(filename);
>
> yes, it looks like storing the function pointer in a
map with the filetype
> as key.
>
> But what is the difference to "Callback.register
name fun" ?
> Callback.register can be called with *several*
different callbacks too.
Ok, but if I'm here, it's because I don't see how to do, so
could you give a ml/C code solution to show how you would
bind
for example this funciton register_sample_file_type() given
in example?
> > As said previously a hack have to be found to bind
this kind of
> > functions, since the method given in the ocaml
manual will not work here.
>
> not sure.
Yes it's sure ! you have seen it in the .tar.gz I've made !
> Can't you give the c-code you want to have a
binding to?
Yes, sure, here for exemple the function
register_sample_file_type :
SAMPLE *load_mp3(const char *filename) {
...
}
SAMPLE *load_ogg(const char *filename) {
...
}
register_sample_file_type("mp3", load_mp3,
NULL);
register_sample_file_type("ogg", load_ogg,
NULL);
--
Regards
Archives up to November 11, 2006 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
ht
tp://groups.yahoo.com/group/ocaml_beginners/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:ocaml_beginners-digest@yahoogroups.com
mailto:ocaml_beginners-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|