See https://github.com/igraph/rigraph/pull/2465 for a working and tested implementation. Apply the same patterns for all functions with callbacks. Ignore SPARSEMAT functions for now.