Using Qt to write Cross Platform Library
is anybody know how to use Qt to write cross-platform class library(not a stand-alone program), to be called by other Qt program?
that is, i can use QObject like QString inside the functions in my library, and still can be identify by other Qt program once it has been loaded by QLibrary
Re: Using Qt to write Cross Platform Library
Yes, you can create a cross platform library, similar to any other library. What you should do is compile the library as normal on every platform and supply a header file with the definitions of the interface to the library (also as normal). By including that header file in the program, the classes/functions/etc in the library are known and the library can be linked to the program during linking.
So, basically you need to create the following:
libLinux.a
libLinux64.a
libSunOs.a
libDefinitions.h
We do this all the time, but then with modules in the development tree.
You can also create a dynamic library, but I don't have any experience with that.
Re: Using Qt to write Cross Platform Library
Add "TEMPLATE = lib" to your project file. If you want your library to be loadable by QLibrary, you also have to make sure that all functions in that library are declared as extern "C":
Code:
extern "C" {
void func1();
void func2();
void func3();
//...
}