0

How could I export a C++ class function to be used with a shared library in Linux for sending continuous updates

I have an application C++ code which has a processing class function called updateFcn, I have to pass in updated structure data every ~100 milliseconds, from a shared library, I could not find the symbol for this class function when trying to access it with dlsym but when I create a non-class extern function I was able to find the symbol for externfunc in my application and can call it through my shared library.

I want to export this class member :

void Myclass::updateFcn(mystruct& rf){
...
}

OR

I have an extern function in the same file externfunc(not a class member) which I could load it from the shared library. Note: I am not using dlopen() since the main executable with symbols exported is loaded into process address space.

extern "C" void externfunc(mystruct& rf){
...
}

how could I call the updateFcn from externfunc without creating a new instance of it each time (as this is a QT gui based application and lot of stuff happens in the constructor)

user2345
  • 537
  • 1
  • 5
  • 22

0 Answers0