1 ;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
3 ;;; libffi-win32.lisp -- libffi CFFI-Grovel definitions for Windows.
5 ;;; Copyright (C) 2009, 2010, 2011, 2012 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.
28 ;; by CRLF0710, modified from Liam Healy 2009-02-22 09:24:33EST libffi-unix.lisp
36 ((:bad-typedef
"FFI_BAD_TYPEDEF"))
37 ((:bad-abi
"FFI_BAD_ABI")))
40 ((:default-abi
"FFI_DEFAULT_ABI"))
42 ((:stdcall
"FFI_STDCALL")))
44 (ctype ffi-abi
"ffi_abi")
46 (ctype :sizet
"size_t")
47 (ctype ushort
"unsigned short")
48 (ctype unsigned
"unsigned")
50 (cstruct ffi-type
"struct _ffi_type"
51 (size "size" :type sizet
)
52 (alignment "alignment" :type ushort
)
53 (type "type" :type ushort
)
54 (elements "elements" :type
:pointer
))
58 ;;; error: invalid application of ‘sizeof’ to incomplete type ‘struct ffi_cif’
59 ;;; When structs are defined with the name at the end, apparently they
60 ;;; are intended to be "opaque types".
61 (cstruct ffi-cif
"struct ffi_cif"
62 (abi "abi" :type ffi-abi
)
63 (nargs "nargs" :type unsigned
)
64 (arg-types "arg_types" :type
:pointer
)
65 (return-type "rtype" :type
:pointer
)
66 (bytes "bytes" :type
:unsigned
)
67 (flags "flags" :type
:unsigned
))
70 (constant (+type-void
+ "FFI_TYPE_VOID"))
71 (constant (+type-int
+ "FFI_TYPE_INT"))
72 (constant (+type-float
+ "FFI_TYPE_FLOAT"))
73 (constant (+type-double
+ "FFI_TYPE_DOUBLE"))
74 (constant (+type-longdouble
+ "FFI_TYPE_LONGDOUBLE"))
75 (constant (+type-uint8
+ "FFI_TYPE_UINT8"))
76 (constant (+type-sint8
+ "FFI_TYPE_SINT8"))
77 (constant (+type-uint16
+ "FFI_TYPE_UINT16"))
78 (constant (+type-sint16
+ "FFI_TYPE_SINT16"))
79 (constant (+type-uint32
+ "FFI_TYPE_UINT32"))
80 (constant (+type-sint32
+ "FFI_TYPE_SINT32"))
81 (constant (+type-uint64
+ "FFI_TYPE_UINT64"))
82 (constant (+type-sint64
+ "FFI_TYPE_SINT64"))
83 (constant (+type-struct
+ "FFI_TYPE_STRUCT"))
84 (constant (+type-pointer
+ "FFI_TYPE_POINTER"))