Hi,
Thank you for the post. I seem to understand better now. But still I am not able to make it work. I think the real problem is exporting the symbol from the library. Actually this library is compiled in C++ so as per the documentation, I have to export it as extern "C". I am doing something wron I know.
let me explain my problem.
In my library I have a class called I_MountInterface. Now, I want to use this class in my main program using QLibrary. I am still not sure about how to call "symbol" in resolve method.
I did it in the following way:
I_MountInterface *mount;
typedef I_MountInterface* (*MyPrototypeOne)();
MyPrototypeOne myFunction = (MyPrototypeOne) lib.resolve(" new I_MountInterface");
if (myFunction){
mount = myFunction();
}
else std::cerr << "myFunction is not valid" << std::endl;
I_MountInterface *mount;
typedef I_MountInterface* (*MyPrototypeOne)();
MyPrototypeOne myFunction = (MyPrototypeOne) lib.resolve(" new I_MountInterface");
if (myFunction){
mount = myFunction();
}
else std::cerr << "myFunction is not valid" << std::endl;
To copy to clipboard, switch view to plain text mode
And I am not sure how to export I_MountInterface class as extern "C" in my library. For testing i did it like following in the constructor of I_MountInterface class in my library:
extern "C" MY_EXPORT I_MountInterface::I_MountInterface() {
std::cout << "I am number 2" << std::endl;
mountDriver = new I_MountDriver;
}
extern "C" MY_EXPORT I_MountInterface::I_MountInterface() {
std::cout << "I am number 2" << std::endl;
mountDriver = new I_MountDriver;
}
To copy to clipboard, switch view to plain text mode
Thank you
Bookmarks