dynamic library building and loading

Jacob Carlborg doob at me.com
Sat Sep 29 09:09:42 PDT 2012


On 2012-09-29 17:40, Maxim Fomin wrote:

> I was not taking about dynamic loading, but about dynamic linking. If I
> understand topic right, the issue is the former, not the latter.

The title of the thread says "... and loading".

> BTW, in majority cases dynamic loading gives no advantages over dynamic
> linking (just the opposite: doing unnecessary job which can be done by
> linker and loader). In most cases, when an app is being written, it is
> known which functional from which third-party libraries would be used.

I agree, in these cases their no point in using dynamic loading.

> The only exceptions I can name are pluggin support and hacker's binary
> ELF/PE tools. I can count few apps in windows and linux which are used
> often, which dynamically load something, and if they do, they likely
> load pluggins. This was made for cases when app developers by definition
> cannot know beforehand full list of used shared libraries.

Exactly, pluggins are one of the main reasons for using dynamic loading. 
An other reason is license issues. There's a D library called Derelict 
which uses dynamic loading to load C libraries (OpenGL, SDL, OpenAL and 
others). One of the many reason for Derelict using dynamic loading is 
due to license issues/complications with these libraries.

http://dsource.org/projects/derelict/

> So, the question is just opposite: "What's the point of using dynamic loading if
> you know beforehand which libraries you use, which happens almost in all
> cases?".

There's no point in doing that. But what I'm saying is if you know 
beforehand the libraries you will use you can get quite far with static 
libraries.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list