views:

164

answers:

3

Hi all, What is the main difference between frame work and dynamic library

+9  A: 

At its heart, an OS X framework is a dynamically linked library. The Framework is a special directory structure called a "framework bundle" that contains one or more versions of the dynamically linked library, as well as dependent frameworks, resources, metadata, etc. Other "bundles" on OS X include .app bundles (which contain an executable as well as resources, dependent frameworks, etc...).

Barry Wark
+5  A: 

Dynamic library is a basic concept mostly independent from the specific platform, i.e. you can talk about dynamic libraries on OSX, Linux, Windows and mean the same basic thing - a piece of relocatable object code with exported API symbols that is composed in a way that allows it to be loaded and shared on demand by applications on the platform.

A framework is an OSX-specific term. It is a package which defines some commonly agreed upon directory structure and stores dynamic libraries, resources, description of the package and other relevant stuff at predefined locations. Which means that it has mostly semantical meaning which allows developers (and tools they create) to refer to it in a commonly understood way. It is worth noting that framework is not required to contain shared libraries at all.

Inso Reiges
But when we say shared library, that means multiple applications running simultaneously can share that single library right?. So suppose what if there is an global variable in the dynamic library and the applications accessing that variable will be having there own instance, how this possible? i am getting confused.
PrithviRaj
@prithviraj - operating systems that share a library code across application share the code segment. the data segment is usually loaded as "copy-on-write", meaning that a single copy is loaded and any code that never changes it shares that copy. As soon as changes are made in the library's data segment, those pages are copied into the application's local memory space while still sharing the read-only code pages.
Jason Coco
+2  A: 

The Anatomy of a Framework might be useful. Specifically the Versions/Current/MyFramework mentioned in that example is a shared library. That section goes on to describe some of the other things that might exist in a framework bundle.

nall