Support exception in C function