Questions tagged [cffi]

CFFI, the Common Foreign Function Interface, for Common Lisp. For Python CFFI, see the [python-cffi] tag.

CFFI, the Common Foreign Function Interface, purports to be a portable foreign function interface for Common Lisp.

Check out Homepage

142 questions
13
votes
4 answers

Building wheel for cffi (setup.py) ... error while installing the packages from requirements.txt in django

I am trying to install a new Django project from git, I created a new virtual envt using python3(version: 3.8.5). When I try to install the required libraries in the requirements.txt, I get the following errors for cffi==1.11.5 package. Building…
Shiwam Jaiswal
  • 171
  • 1
  • 1
  • 7
8
votes
1 answer

Unable to extract informations from p12 file in Common Lisp

I'm trying to extract informations from a client certificate encrypted in PKCS#12 in Common Lisp. I've tried with the following steps: Load the given p12 file onto BIO with d2i_PKCS12_bio Verify the password with PKCS12_verify_mac Parse the file…
fukamachi
  • 91
  • 3
7
votes
1 answer

Interpret foreign memory as lisp memory (or vice versa) without copying data

I try to write BLOB into database - chunk by chunk, using database API C-function (say, db-write-chunk). This function takes a pointer to a foreign memory (where chunk is placed) as an argument. So, I make buffer for a chunk: foreign-buffer. I'll…
MrCat
  • 107
  • 2
7
votes
0 answers

Calling Haskell from Common Lisp (SBCL)

I am trying to call Haskell (ghc version 7.6.3) from Common Lisp (sbcl version 1.2.4) on a debian pc. The Haskell code is {-# LANGUAGE ForeignFunctionInterface #-} module Safe where import Foreign.C.Types fibonacci :: Int -> Int fibonacci n =…
Dimitris
  • 151
  • 9
7
votes
1 answer

CFFI fails in Python (Linux) virtual environment -- attempting to install cryptography package in venv

Installing cffi in the virtual environment encounters errors, but seems to install. Are these errors actually critical, ones that could lead it to fail when installing cryptography (see further below)? pip install cffi==1.11.5 Downloading/unpacking…
murmur0m
  • 141
  • 1
  • 2
  • 9
7
votes
0 answers

CFFI hangs on certain functions

I'm writing a FFI on Common Lisp for Chipmunk2d (a 2D physics simulation library) using CFFI. When I evaluate on the REPL: > (cp:moment-for-circle 100 0 1 #(0 0)) (translate-into-foreign-memory 100 #
Jam
  • 73
  • 4
6
votes
5 answers

certbort commands return ModuleNotFoundError: No module named '_cffi_backend'

I followed a guide to get my python flask app running and I am at the last step where I change http into https with certbot. But when I run my certbot command sudo certbot --nginx -d domainname -d www.domainname I get ModuleNotFoundError: No module…
Quinten C
  • 660
  • 1
  • 8
  • 18
6
votes
1 answer

Common Lisp CFFI: pointer to the pointer

I am trying to write the CFFI wrapper for Sundials CVODE library. SWIG was choking on Sundials headers since they are quite interconnected and SWIG couldn't find the right headers, so I did it by hand: a bit laborious but I've managed. Now I'm…
mobiuseng
  • 2,326
  • 1
  • 16
  • 30
6
votes
1 answer

Code runs in SLIME+SBCL but not plain SBCL

I've been trying to build a lispy interface to the CFFI bindings (https://gitorious.org/dh-misc/hdf5/source/cb616fd619a387e3cdc927994b9ad12b6b514236:) but I ran into a situation where code runs correctly in SLIME which has an SBCL instance as the…
ghollisjr
  • 153
  • 7
6
votes
1 answer

Lisp, cffi, let and memory

I've build some toy C++ library to quickly create a Qt window from Lisp. I know that common-qt exists, I'm just trying to learn how to use cffi. Right now, I have 4 binded functions : create-application : create a QApplication and return a…
Filippo
  • 157
  • 3
5
votes
0 answers

Segmentation fault using CFFI when switching from Python 2 to Python 3

I am trying to execute a tiny CFFI app using python 3, but I always get Segmentation fault: 11. When I compile the same code using python 2, it works. api.py import cffi ffibuilder = cffi.FFI() with open('inter.h') as f: data = ''.join([line…
mvm
  • 51
  • 2
5
votes
1 answer

simplest possible python cffi example

I am trying to call a c function or c program from python using cffi, but I find most examples too complex for me to easily learn from. One of the best examples I have found is this example and I have copied that and made a slightly simpler version…
iamoumuamua
  • 351
  • 2
  • 11
5
votes
1 answer

Dereference FFI pointer in Python to get underlying array

I have a C FFI written in Rust, called src/lib.rs that looks like the following: // compile with $ cargo build extern crate libc; use self::libc::{size_t, int32_t}; use std::cmp::min; use std::slice; #[no_mangle] pub extern "C" fn…
The Unfun Cat
  • 29,987
  • 31
  • 114
  • 156
5
votes
3 answers

Passing structs by value with cffi-libffi?

I'm under the impression that CFFI cant pass structs by value, but the CFFI documentation says: To pass or return a structure by value to a function, load the cffi-libffi system and specify the structure as (:struct structure-name). To pass or…
user2735131
4
votes
0 answers

Getting error "TypeError: cannot pickle '_cffi_backend.FFI' object" in Python

this cffi library was installed by some dependency, and now it is rising this error: File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\multiprocessing\pool.py", line 372, in starmap …
HuLu ViCa
  • 5,077
  • 10
  • 43
  • 93
1
2 3
9 10