[pypy-dev] Call rpython from outside

Aleksandr Koshkin tinysnippets at gmail.com
Sun Jul 16 07:35:14 EDT 2017


Great!

16 июл. 2017 г. 2:32 ПП пользователь "Maciej Fijalkowski" <fijall at gmail.com>
написал:

> Hi Armin
>
> We ended up (Aleksandr is here at pycon russia) using rffi_platform to
> get the exact shape of the structure from the header file. There were
> a few bugs how exactly this got mapped, so it ended up being a good
> way to do it.
>
> On Sat, Jul 15, 2017 at 8:02 AM, Armin Rigo <armin.rigo at gmail.com> wrote:
> > Hi Aleksandr,
> >
> > On 11 July 2017 at 18:33, Aleksandr Koshkin <tinysnippets at gmail.com>
> wrote:
> >> So ok, I have to specify headers containing my structs and somehow push
> it
> >> to rpython toolchain, if I got you correctly.
> >> 0. Why? This structures are already described in the vm file as a bunch
> of
> >> ffi.CStruct objects.
> >
> > rffi.CStruct() is used to declare the RPython interface for structs
> > that are originally defined in C.
> >
> > You can use lltype.Struct(), but it's not recommended in your case
> > because lltype.Struct() is meant to define structs in RPython where
> > you *don't* need a precise C-level struct; for example,
> > lltype.Struct() could rename and reorder the fields in C if it is more
> > efficient.
> >
> > We don't have a direct way to declare the struct in RPython but also
> > force it to generate exactly the C struct declaration you want,
> > because we never needed it.  You need to use rffi.CStruct() and write
> > the struct in the .h file manually too.
> >
> >> 1. If I have to, how would I do that, is there any example of embedding
> >> rpython into something?
> >
> > Not really.  Look maybe at tests using rpython.rlib.entrypoint, like
> > rpython/translator/c/test/test_genc:test_entrypoints.
> >
> >
> > A bientôt,
> >
> > Armin.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20170716/eef6e609/attachment.html>


More information about the pypy-dev mailing list