user1952500
user1952500

Reputation: 6771

DLL load in Windows

In Windows if there are two processes each using the same DLL then apparently each process separately loads the DLL into its address space while in Linux a shared-object is loaded once and mapped into different processes. Can someone explain to me the pros and cons of the Windows approach ?

Upvotes: 0

Views: 141

Answers (1)

Steve Valliere
Steve Valliere

Reputation: 1207

I'm not sure the difference is so stark. Windows shares everything except the data segment between all users of a DLL by loading the DLL once and mapping the shared parts into each process. However, any global data in the DLL is loaded separately for each process so that processes don't unintentionally share data. I'd be surprised if linux wasn't very similar, otherwise shared libraries could pose significant security risks, not to mention potential reliability issues as well. Here are a couple references:

From stackoverflow:

Are .dll files loaded once for every program or once for all programs?

From wikipedia:

http://en.wikipedia.org/wiki/Dynamic-link_library

Upvotes: 2

Related Questions