0
votes

I have this code:

FLAC__StreamDecoderWriteStatus writeCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) {
   //impl....
}

and then later on I have this declaration:

{    
/// stuff
FLAC__StreamDecoderWriteStatus (*writeCallbackPtr) (const FLAC__StreamEncoder *, const FLAC__byte  , size_t , unsigned , unsigned , void *) = writeCallback;
// more stuff
}   

My understanding of the error is that the two are of different types, but I don't understand what I'm doing wrong in this case.

1

1 Answers

1
votes

Your declaration is wrong, it should be

FLAC__StreamDecoderWriteStatus (*writeCallbackPtr) (
    const FLAC__StreamEncoder *, 
    const FLAC__byte[], 
    /*         here ^ you missed the [] */         
    size_t , 
    unsigned , 
    unsigned , 
    void *) = writeCallback;