Adding C API; overloaded new / delete operators for MEX gateways