simple dynamic dispatch for C