See How to add the support of the get_next_object() callback to the 5-c_stats example? - #9 by josephm