PSARC/2014/110 CFFI: foreign function interface for Python calling C code
18468609 integrate cffi
This patch contains some workarounds specially needed for Solaris 11.
Due to
18617452 SIZEOF_WCHAR_T undefined in pyconfig.h on 11.2
SIZEOF_WCHAR_T isn't ever defined, leading to poor support of wchar_t and
unicode. Defining that constant prior to including wchar_helper.h helps
work around most of the resulting test failures.
In Solaris 12, libnsl has been turned into a filter library for libc, and
symbols like inet_ntoa are available directly from libc. But this has not
happened in Solaris 11, so opening libnsl is required in order to find that
particular symbol.
--- cffi-0.8.2/c/_cffi_backend.c 2014-03-06 22:51:56.000000000 -0800
+++ cffi-0.8.2/c/_cffi_backend.c 2014-04-17 15:46:17.277512131 -0700
@@ -219,6 +219,7 @@ static void init_errno(void) { }
# include "file_emulator.h"
#endif
+#define SIZEOF_WCHAR_T 4
#ifdef HAVE_WCHAR_H
# include "wchar_helper.h"
#endif
--- cffi-0.8.2/testing/test_function.py 2014-03-06 22:51:56.000000000 -0800
+++ cffi-0.8.2/testing/test_function.py 2014-04-17 13:37:51.091873904 -0700
@@ -286,7 +286,7 @@ class TestFunction(object):
struct in_addr { unsigned int s_addr; };
char *inet_ntoa(struct in_addr in);
""")
- ffi.C = ffi.dlopen(None)
+ ffi.C = ffi.dlopen("nsl")
ina = ffi.new("struct in_addr *", [0x04040404])
a = ffi.C.inet_ntoa(ina[0])
assert ffi.string(a) == b'4.4.4.4'