1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

C/C++ Question Pass reference/instance of an existing B4R library to constructor

Discussion in 'Libraries developers questions' started by Johan Schoeman, Jun 3, 2019.

  1. Johan Schoeman

    Johan Schoeman Expert Licensed User

    RLiquidCrystal is an existing library in B4R. How would one wrap the below constructor to pass it to a wrapper for LcdBarGraph and how would one then pass rLiquidCrystal from B4R to LcdBarGraph?

    // -- constructor
    LcdBarGraph::LcdBarGraph(LiquidCrystal* lcd, byte numCols, byte startX, byte startY)
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. You need to use the placement constructor. See how B4RLiquidCrystal::Initialize is implemented. Specifically the use of (backend).

    2. Your class should accept a B4RLiquidCrystal parameter and then get the hidden (see the h file) public lc field.
    Johan Schoeman likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice