PDA

View Full Version : Shared Library Creation



tntcoda
30th January 2009, 20:55
Hi,

I was wondering if someone could point me to some docs, or give me a small example of some code for a simple shared library. Basically I want to create a lib with 2 functions in it that can be loaded with QLibrary, ideally the code will cross compile easily for a .so on Linux and .dll on windows.

I might be mixing C with C++ in the library's, and from what ive read i might have to declare 'extern c' or something :confused:

Anyone have a simple generic example for a library file, along with a qmake file?

Thanks very much

kandalf
1st February 2009, 00:48
I's been a while since I've done something like this but, I think, for qmake you just need to specify TEMPLATE = lib and the rest of the options are the same for any qmake project.
For more specific qmake's settings, search for qmake on assistant.

For shared libraries themselves, you might want to ask google about that, it will help you better than I, but I did a search "how to create c++ shared libraries" and the first result is this:
http://www.iram.fr/~roche/code/c++/c++_AddNumbers.html

Hope it helps.