> It enables link-time optimizations.  The compiler/linker can see further into 
> to the source, and detect errors not seen at the module level.
>
> It's saying that your callback routine must be declared/typedefed as a 
> "curl_write_callback".

Thanks Tim.

Which is actually:

typedef size_t (*curl_write_callback)(char *buffer,
                                      size_t size,
                                      size_t nitems,
                                      void *outstream);

as per curl.h and is the same as the example code:

https://curl.se/libcurl/c/getinmemory.html

so if I switch to:


static curl_write_callback curl_to_jansson_to_version(void *buffer, size_t size,
                                    size_t nmemb, json_t *json)
{


I get:

Incompatible integer to pointer conversion returning 'unsigned long'
from a function with result type 'curl_write_callback' (aka 'unsigned
long (*)(char *, unsigned long, unsigned long, void *)')

error: returning ‘size_t’ {aka ‘long unsigned int’} from a function
with return type ‘curl_write_callback’ {aka ‘long unsigned int
(*)(char *, long unsigned int,  long unsigned int,  void *)’} makes
pointer from integer without a cast [-Werror=int-conversion]
   43 |         return size * nmemb;
      |                ~~~~~^~~~~~~


so I'd need to cast that.


Gavin Henry.
https://sentrypeer.org
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to