[SOLVED]Default Arguments in shared library



  • dear all,

    Can we give default parameter in the shared library?

    we use to typedef the function from the library & in typdef we define return type and input argument type.

    so it will not accept if some argumnets are missing.

    for example:

    In library if i give like this,

    @NUMPADLIBRARYSHARED_EXPORT NumberPanel* getNumKBPanel(short int,QWidget*,double incRatio=1);@

    and in application i use it as,

    @ typedef QWidget* (pf2)(short int,QWidget);
    pf2 getNumKBPanel = (pf2)kbPanel->resolve("getNumKBPanel");
    QWidget *w = getNumKBPanel(pValue,this); @

    its working without default value 1.

    how to do that.

    suggestions are welcome.



  • You can't. The signature of the function is @NumberPanel* (fn)(short int, QWidget*, double);@
    Your cast is dangerous, and will NOT work.



  • ok.one question about this forum.how you added your photo.i tried but can't find it where? :-)



  • instead of default argumements... i overloaded the function with required arguments....and its ok...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.