User forums > Using Code::Blocks

inherit static library dependencies

<< < (2/2)

zabzonk:

--- Quote --- does this mean my userProg depends on both my own "userLib" and the sdk library?

--- End quote ---

Yes. Your project is dependent on both the userLib and SDK libraries and headers. The userLib is dependent on the SDK headers, but not on the SDK library.

das-d:
ok with shared librarys this behaviour is different I guess?

What I never found out yet, sorry I'm new to deep c programming and bigger projects, is a shared library loaded once or twice in target system if two applications running using it. What I mean is if I have some sort of init stuff that should be used seperate by each application for example. Does Application A sees the "initialized" library if Application B that uses the same shared library have already executed the init sequence?

Edit: One of my books says: "dynamic librarys use all the same code, they are loaded only once". That means they share any values of their variables also, correct?

Sorry if this is a stupid question!

BR daniel

zabzonk:
@das-d

This is getting off-topic, but yes, shared libraries and DLLs are different - they are much more like executables than static libraries, and they  _do_ link with their dependent libraries, or at least with the dependent libraries import libs.


--- Quote ---That means they share any values of their variables also, correct?
--- End quote ---

Nope. By default, each loaded instance of a shared library shares code, but gets its own data segment. If two applications use the same shared library, they do not share data.

das-d:
Thanks for reply to offtopic!

You have really helped me, now I can decide if shared or static librarys are better in my case.

BR Daniel

Navigation

[0] Message Index

[*] Previous page

Go to full version