Skip to content

function call inlining broken (at least on ARM)

steps to reproduce: Use CFFI v0.15.0

create shared object with function:

double
my_frustum (double r, double l, double b, double t, double n, double f) {
        printf(…);
        return f + 10*n + 100*t + …;
}

EOF

gcc -c -Wall -fpic frustum.c
gcc -shared -o libfrustum.so frustum.o

call it from repl (load cffi first):

(load-foreign-library "/home/jack/my-frustrum/libfrustrum.so")
(defun xxx ()
  (foreign-funcall "my_frustum"
     :double 1.0 :double 2.0 :double 3.0 :double 4.0 :double 5.0 :double 6.0
     :double))
(xxx)

Result is OK, now compile xxx and call it again

(compile 'xxx)
(xxx)

Result is a trash

Proposed solution: remove inlining (always use dffi) or fix it