On Fri, Nov 6, 2015 at 7:21 AM, Kyle Lawlor <
klawl...@gmail.com> wrote:
> Hi, Robert.
>
> Thanks for the response. I will carefully consider your advice.
>
> What do you think of wrapping the Arduino C/C++ code? I've tried to wrap
> this file called Arduino.h, which defines the basic arduino syntax. See here
> for Arduino.h. Here is my pyx file. I just wanted to do the bare minimum,
> hence the `pass` statement in the extern block (to figure out how to handle
> the #include statements throughout). Here is the setup.py I use to build.
> Here are the errors I am getting after trying to build. The main error seems
> to be "error: conflicting types for ‘intptr_t’". Given my background, I'm
> pretty stumped by this.
You're including multiple files that define intptr_t, You'd have to
look at the generated code to see where.
> Anyway, my premise for wrapping the library is that if I can import parts of
> the library in python, it will be easier to write out a C++ file to upload,
> from Blink.py for example.
If the code compiled what would you do with the resulting .so file (or
.dll on windows)? You can't actually run it on Arduino without
building the Python interpreter itself to run on Arduino, and Cython
extensions can't be used without that, and I'm willing to bet the
"micro-Python" projects to run Python on embedded devices are not
fully CPython compatible. And as I understand it the C/C++ dialect
supported by Arduino is somewhat restricted.
If your function uses absolutely no Python (e.g. cdef nogil) you could
possibly run Cython on it and try copying the relevant snippet of C
out of the generated C file and plugging that into an Arduino "C" file
and run from there, but I just don't think Cython is the right tool
for the job unless/until CPython also runs on these chips (at which
point it will be quite useful).
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "cython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
cython-users...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.