1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
3 ;;; libffi-types.lisp -- CFFI-Grovel definitions for libffi
5 ;;; Copyright (C) 2009, 2010, 2011, 2017 Liam M. Healy <lhealy@common-lisp.net>
7 ;;; Permission is hereby granted, free of charge, to any person
8 ;;; obtaining a copy of this software and associated documentation
9 ;;; files (the "Software"), to deal in the Software without
10 ;;; restriction, including without limitation the rights to use, copy,
11 ;;; modify, merge, publish, distribute, sublicense, and/or sell copies
12 ;;; of the Software, and to permit persons to whom the Software is
13 ;;; furnished to do so, subject to the following conditions:
15 ;;; The above copyright notice and this permission notice shall be
16 ;;; included in all copies or substantial portions of the Software.
18 ;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 ;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 ;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 ;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 ;;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 ;;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 ;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ;;; DEALINGS IN THE SOFTWARE.
31 (define "_GNU_SOURCE")
33 ;; When installed through Mac Ports, libffi include files
34 ;; will be found in /opt/local/include.
36 (cc-flags "-I/opt/local/include/")
39 (cc-flags "-I/usr/local/include")
42 (cc-flags "-I/usr/local/include")
44 (pkg-config-cflags "libffi" :optional t
)
53 ((:bad-typedef
"FFI_BAD_TYPEDEF"))
54 ((:bad-abi
"FFI_BAD_ABI")))
58 ((:default-abi
"FFI_DEFAULT_ABI")))
60 #+(and windows x86-64
)
62 ((:default-abi
"FFI_DEFAULT_ABI"))
63 ((:win64
"FFI_WIN64")))
65 #+(and windows
(not x86-64
))
67 ((:default-abi
"FFI_DEFAULT_ABI"))
69 ((:stdcall
"FFI_STDCALL")))
71 #-
(or freebsd windows
)
73 ((:default-abi
"FFI_DEFAULT_ABI"))
77 ((:unix64
"FFI_UNIX64")))
79 (ctype ffi-abi
"ffi_abi")
81 (ctype size-t
"size_t")
83 (cstruct ffi-type
"struct _ffi_type"
84 (size "size" :type size-t
)
85 (alignment "alignment" :type
:unsigned-short
)
86 (type "type" :type
:unsigned-short
)
87 (elements "elements" :type
:pointer
))
89 (cstruct ffi-cif
"ffi_cif"
90 (abi "abi" :type ffi-abi
)
91 (argument-count "nargs" :type
:unsigned-int
)
92 (argument-types "arg_types" :type
:pointer
)
93 (return-type "rtype" :type
:pointer
)
94 (bytes "bytes" :type
:unsigned-int
)
95 (flags "flags" :type
:unsigned-int
))
97 (constant (+type-void
+ "FFI_TYPE_VOID"))
98 (constant (+type-int
+ "FFI_TYPE_INT"))
99 (constant (+type-float
+ "FFI_TYPE_FLOAT"))
100 (constant (+type-double
+ "FFI_TYPE_DOUBLE"))
101 (constant (+type-longdouble
+ "FFI_TYPE_LONGDOUBLE"))
102 (constant (+type-uint8
+ "FFI_TYPE_UINT8"))
103 (constant (+type-sint8
+ "FFI_TYPE_SINT8"))
104 (constant (+type-uint16
+ "FFI_TYPE_UINT16"))
105 (constant (+type-sint16
+ "FFI_TYPE_SINT16"))
106 (constant (+type-uint32
+ "FFI_TYPE_UINT32"))
107 (constant (+type-sint32
+ "FFI_TYPE_SINT32"))
108 (constant (+type-uint64
+ "FFI_TYPE_UINT64"))
109 (constant (+type-sint64
+ "FFI_TYPE_SINT64"))
110 (constant (+type-struct
+ "FFI_TYPE_STRUCT"))
111 (constant (+type-pointer
+ "FFI_TYPE_POINTER"))