Shared Libraries

Shridhar Daithankar shridhar_daithankar at persistent.co.in
Wed Mar 27 08:22:03 UTC 2002


On 25 Mar 2002 at 17:32, August Hörandl wrote:

> shared libraries are supported: just create a subdirectory, whatever
> class you put there will go into a library: static or shared - it is 
> your choice

Thanks. I tried and it worked. (I mean I got it working ..;-)). but I still 
have some problems. Or rather to-dos.

1)When I write a shared library in a project and link it from main program, how 
do I include it's headers.

e.g. Say project is in ~/testsl. So main source tree is ~/testsl/testsl. 
Library tree is  ~/testsl/testsl/lib1.

Now I have done #include "lib1/foo.h" and it works. But when it comes to 
include headers from one module in another, are there any guidelines.

OK Tweaking -I option in project setup is easy and is one option. But does that 
understand shell variables? Will I be able to say $DEVELDIR as root of my 
project and everything works even if I change physical dirs?.

2)How do I control order in which modules get compiled in shared libraries? As 
far as I understand, the first one created will be compiled first. But is there 
any way to control compilation order and especially setting up dependencies.

3)In a test project where I linked main.cpp against a module library lib1 just 
by adding -llib1 to additional libraries in project->options->Liker options. 
But when I do ldd on generated binary it doesn't recognise it as a dynamic 
executable. Same for strip and nm. But it works.

I do a make install of same and do ldd on installed binary and it shows 
everything correctly. And it even works when project installation is in odd 
folders like /mnt2/tmp and /mnt2/tmp/lib is not in 
LD_LIBRARY_PATH//etc/ld.so.conf.

4)How do I maintain a shared library project? Like a dll project in MSVC? Right 
now What I think is to create a custom project and add a module to it. That way 
it won't add a redundant binary to project. Is this correct? I haven't tested 
it.

>From what I have seen in a short experiment, KDevelop's ability to manage and 
maintain library modules is perfectly working but it's bit more rigid than 
desired and doesn't offer much control once module created. I think disciplined 
coding shouldn't face any problem but most people won't do that..;-)

Regards
 Shridhar





More information about the KDevelop-devel mailing list