libcurl callbacks w/c++ class members

后端 未结 2 1834
一个人的身影
一个人的身影 2021-01-25 10:44

Taken from the libcurl programming tutorial on the libcurl site:

libcurl with C++

There\'s basically only one thing to keep in mind when using

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-25 11:43

    A non-static member function is normally not allowed as a C callback because it needs also the instance pointer as a hidden parameter, which is not provided by the calling C code (and this hidden parameter, depending from the compiler, may not be passed according to the "regular" calling convention, but in a particular register, ...).

    Static member functions, instead, are "normal" functions with a particular scope (which is not relevant as far as the ABI is concerned).

提交回复
热议问题