]> granicus.if.org Git - curl/commitdiff
Jason Nye pointed out that callbacks don't need to use the "C namespace"
authorDaniel Stenberg <daniel@haxx.se>
Wed, 14 Jul 2004 15:32:09 +0000 (15:32 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 14 Jul 2004 15:32:09 +0000 (15:32 +0000)
docs/libcurl/libcurl-tutorial.3

index 1c2215de50b7e4b1648020713d9772906ba25677..14c8988c43d8b5380937a5555379a4d14354e247 100644 (file)
@@ -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