Skip to content
Snippets Groups Projects
Commit a92b7c1b authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Jason Nye pointed out that callbacks don't need to use the "C namespace"

parent 0c54013e
No related branches found
No related tags found
No related merge requests found
......@@ -571,24 +571,20 @@ CURLOPT_PROGRESSDATA. libcurl won't touch it.
There's basically only one thing to keep in mind when using C++ instead of C
when interfacing libcurl:
"The Callbacks Must Be Plain C"
The callbacks CANNOT be non-static class member functions
So if you want a write callback set in libcurl, you should put it within
\&'extern'. Similar to this:
Example C++ code:
.nf
extern "C" {
size_t write_data(void *ptr, size_t size, size_t nmemb,
void *ourpointer)
class AClass {
static size_t write_data(void *ptr, size_t size, size_t nmemb,
void *ourpointer)
{
/* do what you want with the data */
}
}
.fi
This will of course effectively turn the callback code into C. There won't be
any "this" pointer available etc.
.SH "Proxies"
What "proxy" means according to Merriam-Webster: "a person authorized to act
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment