Hello. I use curl library and need to overwrite default behavior of data/headers writing. I use
curl_easy_setopt(curl, CurlOption.headerfunction, &header_func); curl_easy_setopt(curl, CurlOption.writeheader, &this); where "this" is a class Inet instance, and header_func is a static function of the class (should be a callback of fwrite() args semantics). The class has buffer for header_func which should copy data from char *ptr to the buffer. In private static size_t header_func(char *ptr, size_t size, size_t nmemb, void *userdata) object is casted back: Inet *net = cast(Inet*)userdata; However, I receive segfault at the beginning of header_func(). I don't know how dmd compiler treats object references. I tried to pass just "this" (without taking address) and cast without * and all 4 combinations of &this/this, cast(Inet*)/cast(Inet); none of them works (segfault on access to Inet class). So, how can I pass an object through void* or may be there is another way to tell header_func() which object should be used? Thanks. P.S. D is a nice language, it's a pleasant to work with)