[pypy-commit] cffi default: Add a note about variadic functions
arigo
noreply at buildbot.pypy.org
Wed Apr 29 12:49:15 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1874:32ec3c43f186
Date: 2015-04-29 12:49 +0200
http://bitbucket.org/cffi/cffi/changeset/32ec3c43f186/
Log: Add a note about variadic functions
diff --git a/doc/source/index.rst b/doc/source/index.rst
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -1078,6 +1078,16 @@
C.printf("hello, %f\n", ffi.cast("double", 42))
C.printf("hello, %s\n", ffi.new("char[]", "world"))
+Note that if you are using ``dlopen()``, the function declaration in the
+``cdef()`` must match the original one in C exactly, as usual --- in
+particular, if this function is variadic in C, then its ``cdef()``
+declaration must also be variadic. You cannot declare it in the
+``cdef()`` with fixed arguments instead, even if you plan to only call
+it with these argument types. The reason is that some architectures
+have a different calling convention depending on whether the function
+signature is fixed or not. (On x86-64, the difference can sometimes be
+seen in PyPy's JIT-generated code if some arguments are ``double``.)
+
Callbacks
---------
More information about the pypy-commit
mailing list