Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; struct allocator_std_type
- ;; {
- ;; void *(*malloc)(size_t);
- ;; void *(*realloc)(void *, size_t);
- ;; void (*free)(void *);
- ;; };
- ;; void *allocator_create(enum allocator_id allocator_id, void *ctx);
- ;; definition created by c2ffi
- ;; (CFFI:DEFCSTRUCT (ALLOCATOR-STD-TYPE :SIZE 24)
- ;; (MALLOC FUNCTION-POINTER :OFFSET 0)
- ;; (REALLOC FUNCTION-POINTER :OFFSET 8)
- ;; (FREE FUNCTION-POINTER :OFFSET 16))
- (defvar *std-ctx* (foreign-alloc '(:struct allocator-std-type))))
- (with-foreign-slots ((malloc realloc free) *std-ctx* (:struct allocator-std-type))
- (setf malloc (foreign-symbol-pointer "malloc")
- realloc (foreign-symbol-pointer "realloc")
- free (foreign-symbol-pointer "free")))
Add Comment
Please, Sign In to add comment