Commit Graph

25 Commits

Author SHA1 Message Date
nielsAD
098dca6b31 Support for calling functions with PASCAL and REGISTER calling conventions on x86 Windows/Linux.
Also changed indentation to be more consistent throughout the (adjusted) files.
2014-08-24 14:29:38 +02:00
Josh Triplett
d36952273d Support fastcall closures
libffi on 32-bit x86 now supports closures for all supported ABIs.
Thus, rewrite the last remaining duplicated-by-ABI test (closure_stdcall
and closure_thiscall) to use the generic ABI_NUM/ABI_ATTR mechanism.
2014-04-20 17:08:37 -07:00
Ole André Vadla Ravnås
3e2b84d295 Fix Windows regression
Introduced by b5fed60194.
2014-04-12 01:06:09 +02:00
Josh Triplett
b5fed60194 Fix ABI on 32-bit non-Windows x86: go back to trampoline size 10
The trampoline size is part of the ABI, so it cannot change.  Move the
logic from the stdcall and thiscall trampolines to the functions they
call, to reduce them both to 10 bytes.

This drops the previously added support for raw THISCALL closures on
non-Windows.  (Non-raw THISCALL closures still work.)
2014-04-05 17:33:42 -07:00
Josh Triplett
56be47f876 Fix a warning on 64-bit Windows
When sizeof(size_t) != sizeof(unsigned), adding a size_t to cif->bytes
produces a "possible loss of data" warning.  However, the size_t in
question refers to the size of a single parameter.  Use a cast to avoid
the warning.
2014-03-24 21:24:53 -07:00
Josh Triplett
48a8eda74a Avoid referencing undefined ABIs on 64-bit Windows builds
64-bit Windows does not have FFI_STDCALL, FFI_THISCALL, or FFI_FASTCALL.
2014-03-24 21:21:12 -07:00
Josh Triplett
e1911f78df Add support for stdcall, thiscall, and fastcall on non-Windows x86-32
Linux supports the stdcall calling convention, either via functions
explicitly declared with the stdcall attribute, or via code compiled
with -mrtd which effectively makes stdcall the default.

This introduces FFI_STDCALL, FFI_THISCALL, and FFI_FASTCALL on
non-Windows x86-32 platforms, as non-default calling conventions.
2014-03-16 05:05:06 -07:00
Zachary Waldowski
1367534158 Darwin/i386: Inhibit Clang previous prototype warnings 2014-02-05 14:28:53 -05:00
Anthony Green
3dc3f32c35 Undo iOS ARM64 changes. 2013-12-05 16:23:25 -05:00
Zachary Waldowski
16ba1b8002 Darwin: Silence Clang warnings. 2013-11-30 03:47:58 -05:00
Vitaly Budovski
6aa15900ac Don't use 16 byte aligned stack for WIN32
This fixes a crash when accessing __stdcall functions in Python ctypes.
2013-09-05 12:05:06 +10:00
Alex Gaynor
ee18766b16 Fix for a crasher due to misaligned stack on x86-32.
Full information on reproduction (using Python's ctypes available here: http://bugs.python.org/issue17423)
2013-03-14 15:00:33 -07:00
Anthony Green
2d9b393975 Fix for closures with sunpro compiler 2013-01-09 21:14:54 -05:00
Zachary Waldowski
39dccddb60 Fix building with Clang for Darwin (OS X 10.6+ and iOS
4.0+)
2012-04-05 12:32:41 -04:00
Peter Rosin
0a1ab12a8d Various MSVC-related changes. 2012-03-30 08:14:08 -04:00
Anthony Green
7c5e60b5f4 Rebase on fixed GCC sources 2012-03-29 08:48:22 -04:00
Anthony Green
dee20f8e45 Rebased from gcc 2012-02-10 13:06:46 -05:00
Anthony Green
1ff9c604bb Rebase from GCC 2012-02-01 16:34:30 -06:00
Anthony Green
0e5843995f Refresh from GCC 2011-02-08 07:52:40 -05:00
Anthony Green
c1d28ba8d5 stdcall-x86-closure-fix 2010-08-05 08:48:16 -04:00
Anthony Green
10ea848900 don't copy win64 struct args 2010-08-05 08:24:27 -04:00
Anthony Green
f2c2a4fce9 Remove warnings and add OS/2 support 2010-04-13 10:19:28 -04:00
Anthony Green
3de1eb36d3 fix-comments patch 2010-03-15 05:57:24 -04:00
Anthony Green
cadeba6cb5 Microsoft Visual C port 2010-01-15 10:46:51 -05:00
Anthony Green
c6dddbd02b Initial commit 2009-10-04 08:11:33 -04:00