Open mtolly opened 8 years ago
@mtolly This is because {#const ...#}
only works for constants defined using #define
, not for enum
values (which is what SFC_SET_VBR_ENCODING_QUALITY
is). That's obviously not very helpful, so let me see if I can work out how to make it more useful!
Ahh! That's totally my mistake; I wasn't even thinking about the difference between those. Feel free to change it or not; I'm already using an {#enum define
for it so I'm good either way.
I suppose the reason to support enum
s would be that often the documentation for a library doesn't distinguish between the two methods -- the relevant libsndfile page just says:
The cmd parameter is an integer identifier which is defined in <sndfile.h>.
All of the valid command identifiers have names beginning with "SFC_".
So one would have to look in the actual header file to see how it's defined. (And, in theory it could even change from version to version.) I guess this is another version of the issue between writing a binding to a function versus a macro.
The
const
feature introduced in #65 isn't working for me; it's simply inserting the C constant name, not its actualdefine
d value.SndfileExtra.chs
:After
c2hs SndfileExtra.chs
,SndfileExtra.hs
:Which of course leads to a GHC error that
SFC_SET_VBR_ENCODING_QUALITY
isn't defined.(Also, I'm just now noticing the typo in
ORIGNAL
.)