I am trying to create a shared library to expose some of the c++ methods.
I simply create a wrapper in which i expose methods as C functions using extern "C" linkage.
Within the corresponding C function i create a object of the class and call the appropriate method.
The issue i have is some of the methods that needs to be exposed use templates as arguments.
E.g. : C++ :
class myclass {
template <typename T>
void write(int addr, T data);
void get_data()
}
C wrapper:
void get_date() {
myclass obj;
obj.get_data();
}
how should i expose the other method ?
- can i use typeid operator in the C wrapper function to determine the type of argument ?
- any other better ideas on this ?