cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
forgottenone has quit [Quit: Konversation terminated!]
oberstet has joined #pypy
todda7 has quit [Quit: Konversation terminated!]
todda7 has joined #pypy
forgottenone has joined #pypy
todda7 has quit [Ping timeout: 272 seconds]
Smigwell has quit [Ping timeout: 260 seconds]
rubdos has quit [Ping timeout: 240 seconds]
rubdos_ has joined #pypy
todda7 has joined #pypy
jemius has joined #pypy
<jemius>
Hi. Am I getting this right: Using cffi, you always have to specify what a struct is made of. I can not simply import structs from a C-header? You always redefine the struct in the python world, manually?
<pmp-p>
afaik you need to know offsets and boundaries from C struct they are system dependant
<pmp-p>
at least if you want to access fields from python, otherwise you can just pass an opaque pointer
<jemius>
How would I define an opaque pointer?
<jemius>
I don't care about accessing fields, it's just a data type generated by C function A, needed by C function B
<pmp-p>
i guess that depends on how many times you will require that
<jemius>
what, why?
<pmp-p>
you can do it manually ( simple as getting/passing an "int" )
<pmp-p>
or you have to link a whole C lib like eg SDL2 and it gets a nightmare so you want handle that transparently
<pmp-p>
what is your use case ?
<jemius>
I need to use the fftw library. That basically consists of creating a fftw_plan (a pointer) and passing it to several functions
tsaka__ has joined #pypy
todda7 has quit [Ping timeout: 264 seconds]
<pmp-p>
the pointer is just an int to pass then
<pmp-p>
ffi will convert it to 4 or 8 bytes automatically
<jemius>
wouldn't it be far better to have a pointer type for that?
<pmp-p>
yeah that's "pointer boxing" but it's slower at runtime
<jemius>
That's confusing
<pmp-p>
indeed
<jemius>
What would be the least dangerous way to pass complex-arrays to a C function? Will python-complex and c-complex automatically match?
<pmp-p>
converting from python objects can be tricky
<arigo>
pmp-p: no, "pointer boxing" is not slower at runtime
<arigo>
jemius: if you have a type "pointer to opaque structure", just say this in the cdef():
<arigo>
typedef struct ... *myptr_t;
<pmp-p>
arigo: you're problably right, i got that from someone saying NaN boxing was faster
<arigo>
with literally dot-dot-dot
<arigo>
jemius: sorry, that's not exactly it
<arigo>
typedef ... *myptr_t;
jemius has quit [Ping timeout: 244 seconds]
<pmp-p>
:(
ronan has joined #pypy
tsaka__ has quit [Ping timeout: 246 seconds]
ronan has quit [Ping timeout: 240 seconds]
jemius has joined #pypy
jemius has quit [Quit: Leaving]
ronan has joined #pypy
tsaka__ has joined #pypy
jcea has joined #pypy
jcea has quit [Remote host closed the connection]
jcea has joined #pypy
tsaka__ has quit [Ping timeout: 272 seconds]
tsaka__ has joined #pypy
Taggnostr2 has quit [Quit: Switching to single player mode.]
Taggnostr has joined #pypy
jcea has quit [Remote host closed the connection]
otisolsen70 has quit [Ping timeout: 256 seconds]
jcea has joined #pypy
tsaka__ has quit [Ping timeout: 244 seconds]
ronan has quit [Ping timeout: 264 seconds]
lritter has joined #pypy
marky1991 has joined #pypy
tsaka__ has joined #pypy
tsaka__ has quit [Remote host closed the connection]
tsaka__ has joined #pypy
forgottenone has quit [Quit: Konversation terminated!]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
tsaka__ has quit [Ping timeout: 246 seconds]
lritter has quit [Quit: Leaving]
marky1991_2 has joined #pypy
marky1991 has quit [Ping timeout: 256 seconds]
marky1991 has joined #pypy
marky1991_2 has quit [Ping timeout: 256 seconds]
marky1991 has quit [Ping timeout: 240 seconds]
otisolsen70 has joined #pypy
jewe37 has joined #pypy
jewe37 has quit [Remote host closed the connection]