Alternatively some kind of result struct can be returned. This will contain the pointer to the function and an error message. It can be explicitly converted to the function pointer. The pointer will be null on failure and the error message will be set. On success the pointer is not null and there is no error message set.