Add all the api and reimplement with c macros