Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57051

Re: Passing C pionters to Python for use with cffi

References <CAAoZyYMhuKtNsQFX8Sbf07-ozbSMhe9MHLdKmQw_=osh6M3PDg@mail.gmail.com> <874n8oibj1.fsf@handshake.de>
Date 2013-10-18 11:11 -0400
Subject Re: Passing C pionters to Python for use with cffi
From Eric Frederich <eric.frederich@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1230.1382109082.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Dieter,

Thanks for the reply.
I actually have a fully working set of bindings using Cython.
I'm looking to move away from Cython and use cffi.
My reasoning is that with cffi my binding package would be pure python.

Also, I want my all my code to be Python, not Cython.
I don't care about performance or compiling my Python to C so that it can
be used.
I just want usable bindings so that I can write extensions as well as use
an interactive Python interpreter.

So... again, just wondering if Py_BuildValue("(k)", &some_structure); is
the proper way to send a void* over to Python so that cffi can cast and use
it.


On Fri, Oct 11, 2013 at 2:09 AM, dieter <dieter@handshake.de> wrote:

> Eric Frederich <eric.frederich@gmail.com> writes:
>
> > I'm extending an application that supports customization using the C
> > language.
> > I am able to write standalone python applications that use the C API's
> > using cffi.
> > This is good, but only a first step.
> >
> > This application allows me to register code that will run on various
> events
> > but it has to be C code.
>
> You might want to have a look at "cython".
>
> "cython" is a compiler compiling source programs in a Python
> extension into "C". The corresponding "C" functions can
> then be called from "C" (you may need to annotate the
> functions used in this way to get proper "GIL" ("Global Interpreter Lock")
> handling).
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Passing C pionters to Python for use with cffi Eric Frederich <eric.frederich@gmail.com> - 2013-10-18 11:11 -0400

csiph-web