Issue #5768: Change to Unicode output logic and test case for same.
[python.git] / Modules / _ctypes / libffi / README
bloba936962f3f612ca050ec4a6f798c6b121e29ffed
1 Status
2 ======
4 libffi-3.0.5 was released on April 3, 2008. Check the libffi web
5 page for updates: <URL:http://sourceware.org/libffi/>.
8 What is libffi?
9 ===============
11 Compilers for high level languages generate code that follow certain
12 conventions.  These conventions are necessary, in part, for separate
13 compilation to work.  One such convention is the "calling convention".
14 The "calling convention" is a set of assumptions made by the compiler
15 about where function arguments will be found on entry to a function.
16 A "calling convention" also specifies where the return value for a
17 function is found.
19 Some programs may not know at the time of compilation what arguments
20 are to be passed to a function.  For instance, an interpreter may be
21 told at run-time about the number and types of arguments used to call
22 a given function.  Libffi can be used in such programs to provide a
23 bridge from the interpreter program to compiled code.
25 The libffi library provides a portable, high level programming
26 interface to various calling conventions.  This allows a programmer to
27 call any function specified by a call interface description at run
28 time.
30 FFI stands for Foreign Function Interface.  A foreign function
31 interface is the popular name for the interface that allows code
32 written in one language to call code written in another language.  The
33 libffi library really only provides the lowest, machine dependent
34 layer of a fully featured foreign function interface. A layer must
35 exist above libffi that handles type conversions for values passed
36 between the two languages.
39 Supported Platforms
40 ===================
42 Libffi has been ported to many different platforms, although this
43 release was only tested on:
45      arm oabi linux
46      arm eabi linux
47      hppa linux
48      mips o32 linux (little endian)
49      powerpc darwin
50      powerpc64 linux
51      sparc solaris
52      sparc64 solaris
53      x86 cygwin
54      x86 darwin
55      x86 freebsd
56      x86 linux
57      x86 openbsd
58      x86-64 darwin
59      x86-64 linux
60      x86-64 OS X
61      x86-64 freebsd
62      
63 Please send additional platform test results to
64 libffi-discuss@sourceware.org.
66 Installing libffi
67 =================
69 [Note: before actually performing any of these installation steps,
70  you may wish to read the "Platform Specific Notes" below.]
72 First you must configure the distribution for your particular
73 system. Go to the directory you wish to build libffi in and run the
74 "configure" program found in the root directory of the libffi source
75 distribution.
77 You may want to tell configure where to install the libffi library and
78 header files. To do that, use the --prefix configure switch.  Libffi
79 will install under /usr/local by default. 
81 If you want to enable extra run-time debugging checks use the the
82 --enable-debug configure switch. This is useful when your program dies
83 mysteriously while using libffi. 
85 Another useful configure switch is --enable-purify-safety. Using this
86 will add some extra code which will suppress certain warnings when you
87 are using Purify with libffi. Only use this switch when using 
88 Purify, as it will slow down the library.
90 Configure has many other options. Use "configure --help" to see them all.
92 Once configure has finished, type "make". Note that you must be using
93 GNU make.  You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
95 To ensure that libffi is working as advertised, type "make check".
96 This will require that you have DejaGNU installed.
98 To install the library and header files, type "make install".
101 Platform Specific Notes
102 =======================
104         MIPS - Irix 5.3 & 6.x
105         ---------------------
107 Irix 6.2 and better supports three different calling conventions: o32,
108 n32 and n64. Currently, libffi only supports both o32 and n32 under
109 Irix 6.x, but only o32 under Irix 5.3. Libffi will automatically be
110 configured for whichever calling convention it was built for.
112 By default, the configure script will try to build libffi with the GNU
113 development tools. To build libffi with the SGI development tools, set
114 the environment variable CC to either "cc -32" or "cc -n32" before
115 running configure under Irix 6.x (depending on whether you want an o32
116 or n32 library), or just "cc" for Irix 5.3.
118 With the n32 calling convention, when returning structures smaller
119 than 16 bytes, be sure to provide an RVALUE that is 8 byte aligned.
120 Here's one way of forcing this:
122         double struct_storage[2];
123         my_small_struct *s = (my_small_struct *) struct_storage;  
124         /* Use s for RVALUE */
126 If you don't do this you are liable to get spurious bus errors. 
128 "long long" values are not supported yet.
130 You must use GNU Make to build libffi on SGI platforms.
133         PowerPC System V ABI
134         --------------------
136 There are two `System V ABI's which libffi implements for PowerPC.
137 They differ only in how small structures are returned from functions.
139 In the FFI_SYSV version, structures that are 8 bytes or smaller are
140 returned in registers.  This is what GCC does when it is configured
141 for solaris, and is what the System V ABI I have (dated September
142 1995) says.
144 In the FFI_GCC_SYSV version, all structures are returned the same way:
145 by passing a pointer as the first argument to the function.  This is
146 what GCC does when it is configured for linux or a generic sysv
147 target.
149 EGCS 1.0.1 (and probably other versions of EGCS/GCC) also has a
150 inconsistency with the SysV ABI: When a procedure is called with many
151 floating-point arguments, some of them get put on the stack.  They are
152 all supposed to be stored in double-precision format, even if they are
153 only single-precision, but EGCS stores single-precision arguments as
154 single-precision anyway.  This causes one test to fail (the `many
155 arguments' test).
158 History
159 =======
161 3.0.5 Apr-3-08
162         Fix libffi.pc file.
163         Fix #define ARM for IcedTea users.
164         Fix x86 closure bug.
166 3.0.4 Feb-24-08
167         Fix x86 OpenBSD configury.
169 3.0.3 Feb-22-08
170         Enable x86 OpenBSD thanks to Thomas Heller, and
171         x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
172         Clean up test instruction in README.
174 3.0.2 Feb-21-08
175         Improved x86 FreeBSD support.
176         Thanks to Björn König.
178 3.0.1 Feb-15-08
179         Fix instruction cache flushing bug on MIPS.
180         Thanks to David Daney.
182 3.0.0 Feb-15-08
183         Many changes, mostly thanks to the GCC project.
184         Cygnus Solutions is now Red Hat.
186   [10 years go by...]
188 1.20 Oct-5-98
189         Raffaele Sena produces ARM port.
191 1.19 Oct-5-98
192         Fixed x86 long double and long long return support.
193         m68k bug fixes from Andreas Schwab.
194         Patch for DU assembler compatibility for the Alpha from Richard
195         Henderson.
197 1.18 Apr-17-98
198         Bug fixes and MIPS configuration changes.
200 1.17 Feb-24-98
201         Bug fixes and m68k port from Andreas Schwab. PowerPC port from
202         Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
204 1.16 Feb-11-98
205         Richard Henderson produces Alpha port.
207 1.15 Dec-4-97
208         Fixed an n32 ABI bug. New libtool, auto* support.
210 1.14 May-13-97
211         libtool is now used to generate shared and static libraries.
212         Fixed a minor portability problem reported by Russ McManus
213         <mcmanr@eq.gs.com>.
215 1.13 Dec-2-96
216         Added --enable-purify-safety to keep Purify from complaining
217         about certain low level code.
218         Sparc fix for calling functions with < 6 args.
219         Linux x86 a.out fix.
221 1.12 Nov-22-96
222         Added missing ffi_type_void, needed for supporting void return 
223         types. Fixed test case for non MIPS machines. Cygnus Support 
224         is now Cygnus Solutions. 
226 1.11 Oct-30-96
227         Added notes about GNU make.
229 1.10 Oct-29-96
230         Added configuration fix for non GNU compilers.
232 1.09 Oct-29-96
233         Added --enable-debug configure switch. Clean-ups based on LCLint 
234         feedback. ffi_mips.h is always installed. Many configuration 
235         fixes. Fixed ffitest.c for sparc builds.
237 1.08 Oct-15-96
238         Fixed n32 problem. Many clean-ups.
240 1.07 Oct-14-96
241         Gordon Irlam rewrites v8.S again. Bug fixes.
243 1.06 Oct-14-96
244         Gordon Irlam improved the sparc port. 
246 1.05 Oct-14-96
247         Interface changes based on feedback.
249 1.04 Oct-11-96
250         Sparc port complete (modulo struct passing bug).
252 1.03 Oct-10-96
253         Passing struct args, and returning struct values works for
254         all architectures/calling conventions. Expanded tests.
256 1.02 Oct-9-96
257         Added SGI n32 support. Fixed bugs in both o32 and Linux support.
258         Added "make test".
260 1.01 Oct-8-96
261         Fixed float passing bug in mips version. Restructured some
262         of the code. Builds cleanly with SGI tools.
264 1.00 Oct-7-96
265         First release. No public announcement.
268 Authors & Credits
269 =================
271 libffi was originally written by Anthony Green <green@redhat.com>.
273 The developers of the GNU Compiler Collection project have made
274 innumerable valuable contributions.  See the ChangeLog file for
275 details.
277 Some of the ideas behind libffi were inspired by Gianni Mariani's free
278 gencall library for Silicon Graphics machines.
280 The closure mechanism was designed and implemented by Kresten Krab
281 Thorup.
283 Major processor architecture ports were contributed by the following
284 developers:
286 alpha           Richard Henderson
287 arm             Raffaele Sena
288 cris            Simon Posnjak, Hans-Peter Nilsson
289 frv             Anthony Green
290 ia64            Hans Boehm
291 m32r            Kazuhiro Inaoka
292 m68k            Andreas Schwab
293 mips            Anthony Green, Casey Marshall
294 mips64          David Daney
295 pa              Randolph Chung, Dave Anglin, Andreas Tobler
296 powerpc         Geoffrey Keating, Andreas Tobler, 
297                          David Edelsohn, John Hornkvist
298 powerpc64       Jakub Jelinek
299 s390            Gerhard Tonn, Ulrich Weigand
300 sh              Kaz Kojima
301 sh64            Kaz Kojima
302 sparc           Anthony Green, Gordon Irlam
303 x86             Anthony Green, Jon Beniston
304 x86-64          Bo Thorsen
306 Jesper Skov and Andrew Haley both did more than their fair share of
307 stepping through the code and tracking down bugs.
309 Thanks also to Tom Tromey for bug fixes, documentation and
310 configuration help.
312 Thanks to Jim Blandy, who provided some useful feedback on the libffi
313 interface.
315 Andreas Tobler has done a tremendous amount of work on the testsuite.
317 Alex Oliva solved the executable page problem for SElinux.
319 The list above is almost certainly incomplete and inaccurate.  I'm
320 happy to make corrections or additions upon request.
322 If you have a problem, or have found a bug, please send a note to
323 green@redhat.com.