On Wed, Jul 30, 2014 at 5:32 AM, Chris Cleeland
In my case, the C API is stashing the value of the pointer in a container, and passing that pointer value as an argument to the registered callback function. That's it. The C code doesn't *do* anything with the pointer because it treats it as a void*.
Then it's a badly-designed C API I'm afraid... SQLite introduced a bunch of _v2 APIs (e.g. [1]) specifically to add a void(*xDestroy)(void*) argument to some of its functions taking a void* user-data argument, to address lifetime issues. That's C programming done right, which interfaces just fine with C++ and shared_ptr and co. The fact that one programs and designs APIs in C doesn't mean one shouldn't care about lifetimes. My $0.02. --DD [1] http://www.sqlite.org/capi3ref.html#sqlite3_create_module