All Manuals > Foreign Language Interface User Guide and Reference Manual

Contents

Preface

1 Introduction to the FLI

1.1 An example of interfacing to a foreign function

1.1.1 Defining the FLI function

1.1.2 Loading foreign code

1.1.3 Calling foreign code

1.2 Using the FLI to get the cursor position

1.2.1 Defining FLI types

1.2.2 Defining a FLI function

1.2.3 Accessing the results

1.3 Using the FLI to set the cursor position

1.4 An example of dynamic memory allocation

1.5 Summary

2 FLI Types

2.1 Immediate types

2.1.1 Integral types

2.1.2 Floating point types

2.1.3 Complex number types

2.1.4 Character types

2.1.5 Boolean types

2.1.6 Pointer types

2.2 Aggregate types

2.2.1 Arrays

2.2.2 Strings

2.2.3 Structures and unions

2.2.4 Vector types

2.2.4.1 Vector type names

2.2.4.2 Vector type values

2.2.4.3 Using a foreign pointer to a vector type

2.2.4.4 Notes on foreign vector types

2.3 Parameterized types

2.4 Encapsulated types

2.4.1 Passing Lisp objects to C

2.4.2 An example

2.5 The void type

2.6 Summary

3 FLI Pointers

3.1 Creating and copying pointers

3.1.1 Creating pointers

3.1.2 Copying pointers

3.1.3 Allocation of FLI memory

3.2 Pointer testing functions

3.3 Pointer dereferencing and coercing

3.4 An example of dynamic pointer allocation

3.5 More examples of allocation and pointer allocation

3.5.1 Allocating an integer

3.5.2 Allocating a pointer to a pointer to a void

3.6 Summary

4 Defining foreign functions and callables

4.1 Foreign callables and foreign functions

4.1.1 Strings and foreign callables

4.2 Specifying a calling convention.

4.2.1 Windows 32-bit calling conventions

4.2.2 ARM 32-bit calling conventions

4.2.3 ARM 64-bit calling conventions

4.2.4 Fastcall on 32-bit x86 platforms

5 Advanced Uses of the FLI

5.1 Passing a string to a Windows function

5.2 Passing and returning strings

5.2.1 Use of Reference Arguments

5.2.2 Passing a string

5.2.3 Returning a string via a buffer

5.2.4 Modifying a string in a C function

5.2.5 Calling a C function that takes an array of strings

5.2.6 Foreign string encodings

5.2.7 Foreign string line terminators

5.2.8 Win32 API functions that handle strings

5.2.9 Mapping nil to a Null Pointer

5.3 Lisp integers

5.4 Defining new types

5.5 Using DLLs within the LispWorks FLI

5.5.1 Using C DLLs

5.5.1.1 Testing whether a function is defined

5.5.2 Using C++ DLLs

5.6 Incorporating a foreign module into a LispWorks image

5.7 Block objects in C (foreign blocks)

5.7.1 Calling foreign code that receives a block as argument

5.7.2 Operations on foreign blocks

5.7.3 Scope of invocation

5.8 Interfacing to graphics functions

5.9 Summary

6 Self-contained examples

6.1 Foreign block examples

6.2 Miscellaneous examples

7 Function, Macro and Variable Reference

align-of

alloca

allocate-dynamic-foreign-object

allocate-foreign-block

allocate-foreign-object

cast-integer

connected-module-pathname

convert-from-foreign-string

convert-integer-to-dynamic-foreign-object

convert-to-dynamic-foreign-string

convert-to-foreign-string

copy-pointer

decf-pointer

define-c-enum

define-c-struct

define-c-typedef

define-c-union

define-foreign-block-callable-type

define-foreign-block-invoker

define-foreign-callable

define-foreign-converter

define-foreign-forward-reference-type

define-foreign-funcallable

define-foreign-function

define-foreign-pointer

define-foreign-type

define-foreign-variable

define-opaque-pointer

dereference

disconnect-module

enum-symbols

enum-symbol-value

enum-symbol-value-pairs

enum-values

enum-value-symbol

fill-foreign-object

foreign-aref

foreign-array-dimensions

foreign-array-element-type

foreign-array-pointer

foreign-block-copy

foreign-block-release

foreign-function-pointer

foreign-slot-names

foreign-slot-offset

foreign-slot-pointer

foreign-slot-type

foreign-slot-value

foreign-typed-aref

foreign-type-equal-p

foreign-type-error

free

free-foreign-block

free-foreign-object

get-embedded-module

get-embedded-module-data

incf-pointer

install-embedded-module

*install-embedded-module-delay-delete*

*locale-external-formats*

make-integer-from-bytes

make-pointer

malloc

module-unresolved-symbols

*null-pointer*

null-pointer-p

pointer-address

pointer-element-size

pointer-element-type

pointer-element-type-p

pointer-eq

pointerp

pointer-pointer-type

print-collected-template-info

print-foreign-modules

register-module

replace-foreign-array

replace-foreign-object

set-locale

set-locale-encodings

setup-embedded-module

size-of

start-collecting-template-info

*use-sse2-for-ext-vector-type*

valid-foreign-type-p

with-coerced-pointer

with-dynamic-foreign-objects

with-dynamic-lisp-array-pointer

with-foreign-block

with-foreign-slots

with-foreign-string

with-integer-bytes

with-local-foreign-block

8 Type Reference

:boolean

:byte

:c-array

:char

:const

:double

:double-complex

:ef-mb-string

:ef-wc-string

:enum

:enumeration

:fixnum

:float

:float-complex

:foreign-array

foreign-block-pointer

:function

:int16

:int32

:int64

:int8

:int

:intmax

:intptr

:lisp-array

:lisp-double-float

:lisp-float

:lisp-simple-1d-array

:lisp-single-float

:long

:long-long

:one-of

:pointer

:ptr

:ptrdiff-t

:reference

:reference-pass

:reference-return

released-foreign-block-pointer

:short

:signed

:size-t

:ssize-t

:struct

:time-t

:uint16

:uint32

:uint64

:uint8

:uintmax

:uintptr

:union

:unsigned

vector-char16

vector-char2

vector-char3

vector-char32

vector-char4

vector-char8

vector-double2

vector-double3

vector-double4

vector-double8

vector-float16

vector-float2

vector-float3

vector-float4

vector-float8

vector-int16

vector-int2

vector-int3

vector-int4

vector-int8

vector-long1

vector-long2

vector-long3

vector-long4

vector-long8

vector-short16

vector-short2

vector-short3

vector-short32

vector-short4

vector-short8

vector-uchar16

vector-uchar2

vector-uchar3

vector-uchar32

vector-uchar4

vector-uchar8

vector-uint16

vector-uint2

vector-uint3

vector-uint4

vector-uint8

vector-ulong1

vector-ulong2

vector-ulong3

vector-ulong4

vector-ulong8

vector-ushort16

vector-ushort2

vector-ushort3

vector-ushort32

vector-ushort4

vector-ushort8

:void

:volatile

:wchar-t

:wrapper

9 The Foreign Parser

9.1 Introduction

9.1.1 Requirements

9.2 Loading the Foreign Parser

9.3 Using the Foreign Parser

9.4 Using the LispWorks Editor

9.4.1 Processing Foreign Code with the Editor

9.4.2 Compiling and Loading Foreign Code with the Editor

9.5 Foreign Parser Reference

*preprocessor*

*preprocessor-format-string*

*preprocessor-include-path*

*preprocessor-options*

process-foreign-file

Glossary

Index


Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:35:02