allow creation of contexts from ffi pointers

I also added a to_ptr method to retrieve its pointer.