I just figured out that the reason segmentation faults were occuring was because i was attempting to define a typedef using (ffi:def-foreign-type :db :pointer-void). and attempting to pass arguments into the function with type :db. If i just used :pointer-void i was fine. I guess then that this is an incorrect way to define new types?