Hi everyone,
I tried to create and use a shared library in qt.I used the c++ library project to create this.

code used to create a shared library:

.pro file:

Qt Code:
  1. QT -= gui
  2.  
  3. TARGET = myLIB
  4. TEMPLATE = lib
  5.  
  6. DEFINES += MYLIB_LIBRARY
  7.  
  8. SOURCES += mylib.cpp
  9.  
  10. HEADERS += mylib.h\
  11. myLIB_global.h
To copy to clipboard, switch view to plain text mode 

.h file

Qt Code:
  1. class MYLIBSHARED_EXPORT MyLIB {
  2. public:
  3. MyLIB();
  4. int add(int x,int y);
  5. };
  6.  
  7. extern "C"
  8. {
  9. int sub(int x,int y);
  10. }
To copy to clipboard, switch view to plain text mode 

.cpp file :

Qt Code:
  1. MyLIB::MyLIB()
  2. {
  3. }
  4. int MyLIB::add(int x, int y)
  5. {
  6. return x+y;
  7. }
  8.  
  9. int sub(int x, int y)
  10. {
  11. return x-y;
  12. }
To copy to clipboard, switch view to plain text mode 

In my test application i am able to use sub function.code is
Qt Code:
  1. typedef int (*pf)(int,int);
  2. pf fun=(pf)QLibrary::resolve("./libmyLIB.so","sub");
  3. int x=fun(20,10);
To copy to clipboard, switch view to plain text mode 
It is working.
But when i am trying to use isLoaded function it is returning false.
Qt Code:
  1. QLibrary myLib("./libmyLIB.so");
  2. ok=myLib.isLoaded();
To copy to clipboard, switch view to plain text mode 


My problem is i want to use the function directly without using QLibrary.(only adding in .pro file)
How i will use add function in my application ?