Giter Site home page Giter Site logo

Comments (4)

alext-mkrs avatar alext-mkrs commented on August 15, 2024

I've performed some research and it looks like this is because it's called first as a library CTOR and second time as a Python/JS module initialization subroutine due to line 29 in mraa.i, where we explicitly ask SWIG to call mraa_init() during module initialization.

I'm not yet that much into SWIG to understand all consequences, but after reading the basic docs and analyzing this from a common sense standpoint :) - if we have it defined as CTOR and libc does call it for us anyway, there's no point in having it in the SWIG %init section.

What do you think?

from mraa.

tingleby avatar tingleby commented on August 15, 2024

Would make sense to me. The mraa.i might not have been updated when the CTOR was added.
Gave it a quick test, removed the init section around line 29 and the modules still works. (At least python)

from mraa.

arfoll avatar arfoll commented on August 15, 2024

ehehe that didn't require much research, I know that. The problem is that I fixed this issue with eec08ac by adding a "nice" #ifndef. The reason for keeping it in %init is historical (ctors came after) and also because ctors get called extremely early and it's a little cleaner IMHO than the rather brutal ctor behaviour. Also we can do cool stuff if %init fails. But yes that would fix the issue.

But really the issue is why #if (defined SWIGPYTHON) || (defined SWIG) doesn't work. Which does worry me - a little. Also that statement should probably be just SWIG.

from mraa.

alext-mkrs avatar alext-mkrs commented on August 15, 2024

Ok, I see. That would've been too easy :) Indeed it does seem to ignore these there, I've just tried several variations. Looks like some deeper digging is in order here.

from mraa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.