Navigator

How to wrap dlopen and dlsym for C++


Use below type of code
Class DynLib
{
    /* All your functions */
    void fun1() {};
    void fun2() {};
    .
    .
    .
}

DynLib getDynLibPointer()
{
    DynLib x;
    return x;
}
use dlopen() for loading this library at runtime. and use dlsym() and call getDynLibPointer()which returns DynLib object. from this object you can access all your functions jst as obj.fun1().....

No comments:

Post a Comment