I'm trying to load a shared object (SensorTemp derived class) at runtime using the dlopen() API. When I try to static-case the pointer to the appropriate function pointer, I get
LinkTest.cpp:26:48: error: invalid static_cast from type ‘void*’ to type ‘Sensor*()’
Sensor* mySensor = static_cast<Sensor *()>(mkr)(myHub, a, b, c, d, e);
Here's the relevant Sensor.h base class constructor:
class Sensor
{
public:
    Sensor(Hub& _pHub, const std::string& _name, const std::string& _type, const std::string& _logLevel, const std::string& _configInfo, const std::string& _location): m_pHub(&_pHub), m_name(_name), m_type(_type), m_logLevel(_logLevel), m_configInfo(_configInfo), m_location(_location) {}
Derived class SensorTemp.h : (its CTOR calls the base CTOR)
#include "Sensor.h"
class SensorTemp : public Sensor
{
public:
    SensorTemp(Hub& _pHub,  const std::string& _name, 
                            const std::string& _type, 
                            const std::string& _logLevel, 
                            const std::string& _configInfo, 
                            const std::string& _location);
    ~SensorTemp() {}
    void* Run();
private:
    int m_lowTemp;
    int m_highTemp;
    int m_interval;
};
extern "C"
{
    SensorTemp* Create(Hub& _pHub,  const std::string& _name, 
                                    const std::string& _type, 
                                    const std::string& _logLevel, 
                                    const std::string& _configInfo, 
                                    const std::string& _location)
    {
        return new SensorTemp(_pHub, _name, _type, _logLevel, _configInfo, _location);
    }
}
#endif //__SENSORTEMP_H__
the test:
int main(int argc, char **argv)
{
    Hub myHub;
    string a = "A";
    string b = "B";
    string c = "C";
    string d = "D";
    string e = "E";
    string f = "F";
    void *hndl = dlopen("./libSensorTemp.so", RTLD_LAZY);
    if(hndl == NULL)
    {
       std::cerr << dlerror() << std::endl;
       exit(-1);
    }
    void *mkr = (Sensor*)dlsym(hndl, "Create");
    Sensor* mySensor = static_cast<Sensor *()>(mkr)(myHub, a, b, c, d, e);
    mySensor->Run();
}
 
     
     
    