Feature/support cffi

rebase @lvella's branch on master