[Kst] Binding via CFFI
Peter Kümmel
syntheticpp at gmx.net
Thu Apr 3 07:42:10 UTC 2014
On 02.04.2014 21:56, Barth Netterfield wrote:
> I would not have found that as the page seems to indicate that this is a
> method of calling C libraries, where for kst we want to control a running
> application. Can CFFI be used to control a running application?
AFAIK you can call functions exported by a binary, but somehow
one has to bind to the running kst process, or create it (but then
it is like binding to a kde-lib).
>
> What Josh implemented was talking to kst over a QLocalSocket. So you can use
> the 'bindings' with anything that can do this, including another application.
Very interesting, I always thought "binding" means linking/calling Kst as library
so that there is only one process.
What you describe sounds more like remote controlling Kst (remote when QLocalSocket
is replaced by QTcpSocket)
What protocol is used? I assume some hacking on bytes or Qt serializations.
A more generic and self-describing alternative would be
https://developers.google.com/protocol-buffers/docs/overview
>
> But this could be interesting is in the part of the interface where we send
> numpyarrays back and forth from kst. It currently uses Weave.
Yes, when the script language runs in the same process like kst, then array
passing simplifies to wrapping pointers.
>
> I'm hoping we can use PyQT4 or PySide purely though.
>
To make this "binding" more attractive to other people it is
better to remove Qt dependencies that to add more.
>
>
> On April 2, 2014 07:30:13 PM Peter Kümmel wrote:
>
>> https://cffi.readthedocs.org
>> Have you evaluated to bind via CFFI?
>>
>> This would require a C-API,
>>
>> typedef struct kst_ClassA;
>> kst_ClassA* kst_ClassA_new();
>> void kst_ClassA_delete(kst_ClassA* self);
>> void kst_ClassA_memberFunction(kst_ClassA* self, int param);
>>
>> and would have the advantage that any binding using a simliar apprach
>> (libffi) are "automatically" supported, e.g.
>> http://luajit.org/ext_ffi.html
>> or
>> https://sourceware.org/libffi/
>>
>> Peter
>> _______________________________________________
>> Kst mailing list
>> Kst at kde.org
>> https://mail.kde.org/mailman/listinfo/kst
>
More information about the Kst
mailing list