Giter Site home page Giter Site logo

C++ compiler has issues with developer scoped functions being passed as void* to the eUI object array about electricui-embedded HOT 2 CLOSED

Scottapotamas avatar Scottapotamas commented on May 28, 2024
C++ compiler has issues with developer scoped functions being passed as void* to the eUI object array

from electricui-embedded.

Comments (2)

Scottapotamas avatar Scottapotamas commented on May 28, 2024

Legitimately not sure if this is doable with a strict C++ compiler, as member functions in C++ get the additional definition of their class' *this as an invisible argument, which isn't compatible with the normal function pointer syntax.

from electricui-embedded.

Scottapotamas avatar Scottapotamas commented on May 28, 2024

https://stackoverflow.com/a/39176329 seems to cover the general issue reasonably well.

The easy way to resolve this seems to be passing in a data pointer, which is actually a pointer to the function (misdirection to trick the compiler).

The following snippet seems to compile fine:

void function_test()
{
  // do the thing
}

eui_cb_t user_callback = &function_test;

eui_message_t tracked_vars[] = 
{
  EUI_FUNC( "test", user_callback ),
};
  • Test the implementation for AVR compiled programs
  • Test Atmel ARM32
  • Test ESP32 compatibility
  • Test a 'pure' gcc C platform with STM32 or something
  • See if it can be dressed in a macro?
  • Documentation/example sketches

from electricui-embedded.

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.