diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-07-14 15:32:09 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-07-14 15:32:09 +0000 |
commit | a92b7c1b16ace4bd238b1208f4baeb82482be42f (patch) | |
tree | 3c9a6421ac0fa432d28b57e6d8ef23ab69f5153b /docs | |
parent | 0c54013ee374a92960c32011c16278e799f58dbf (diff) |
Jason Nye pointed out that callbacks don't need to use the "C namespace"
Diffstat (limited to 'docs')
-rw-r--r-- | docs/libcurl/libcurl-tutorial.3 | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/docs/libcurl/libcurl-tutorial.3 b/docs/libcurl/libcurl-tutorial.3 index 1c2215de5..14c8988c4 100644 --- a/docs/libcurl/libcurl-tutorial.3 +++ b/docs/libcurl/libcurl-tutorial.3 @@ -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 |