22:
233:
can be used to ensure the correct library files are available. This allows the library files to be shared between many applications leading to space savings. It also allows the library to be updated to fix bugs and security flaws without updating the applications that use the library. In practice,
205:
With static linking, it is enough to include those parts of the library that are directly and indirectly referenced by the target executable (or target library). With dynamic libraries, the entire library is loaded, as it is not known in advance which functions will be invoked by applications.
193:
them. The most significant advantage is that the application can be certain that all its libraries are present and that they are the correct version. This avoids dependency problems, known colloquially as
286:
for indicating external or internal linkage, in addition to providing other features. To create such a library, the exported functions/procedures and other objects variables must be specified for
213:
rather than in separate files. But if library files are counted as part of the application then the total size will be similar, or even smaller if the compiler eliminates the unused symbols.
530:
523:
516:
202:. Static linking can also allow the application to be contained in a single executable file, simplifying distribution and installation.
483:
251:
170:
105:
39:
86:
43:
58:
539:
692:
65:
209:
In static linking, the size of the executable becomes greater than in dynamic linking, as the library code is stored
644:
32:
639:
608:
230:
72:
556:
275:
178:
54:
613:
500:
Private DLLs are DLLs that are installed with a specific application and used only by that application.
234:
many executables (especially those targeting
Microsoft Windows) use both static and dynamic libraries.
623:
415:
283:
460:
588:
571:
395:
666:
654:
561:
405:
400:
243:
147:
139:
671:
436:
421:
312:
222:
649:
293:
288:
242:
Any static library function can call a function or procedure in another static library. The
119:
79:
487:
206:
Whether this advantage is significant in practice depends on the structure of the library.
189:
There are several advantages to statically linking libraries with an executable instead of
259:
199:
190:
130:
is a set of routines, external functions and variables which are resolved in a caller at
225:
it is common to include the library files an application needs with the application. On
659:
603:
410:
255:
686:
593:
508:
174:
583:
390:
154:
131:
618:
598:
426:
247:
162:
143:
21:
566:
431:
166:
150:
304:
226:
195:
135:
161:. Static libraries are either merged with other static libraries and
153:. This executable and the process of compiling it are both known as a
279:
512:
318:
For example, on a Unix-like system, to create an archive named
262:
module loader). However, whether such a process can be called
15:
246:
and loader handle this the same way as for kinds of other
157:
of the program. Historically, libraries could only be
632:
547:
46:. Unsourced material may be challenged and removed.
455:
453:
451:
524:
337:ar rcs libclass.a class1.o class2.o class3.o
8:
531:
517:
509:
299:). Static library filenames usually have "
274:Static libraries can be easily created in
134:and copied into a target application by a
362:is placed in standard library path, like
165:during building/linking to form a single
106:Learn how and when to remove this message
250:. Static library files may be linked at
447:
334:, the following command would be used:
177:of their corresponding executable at a
181:determined at compile-time/link-time.
381:cc main.c class1.o class2.o class3.o
340:to compile a program that depends on
7:
44:adding citations to reliable sources
270:Creating static libraries in C/C++
14:
20:
486:. microsoft.com. Archived from
229:systems this is less common as
31:needs additional citations for
282:. These two languages provide
1:
482:Anderson, Rick (2000-01-11).
540:Application binary interface
185:Advantages and disadvantages
709:
645:Foreign function interface
375:ld ... main.o -lclass ...
231:package management systems
142:, or binder, producing an
640:Binary-code compatibility
609:Position-independent code
292:(i.e. by not using the C
128:statically linked library
284:storage-class specifiers
484:"The End of DLL Hell"
355:cc main.c libclass.a
211:within the executable
624:Virtual method table
416:Dynamic-link library
372:or (during linking)
217:Environment specific
179:static memory offset
40:improve this article
589:Memory segmentation
396:Library (computing)
238:Linking and loading
191:dynamically linking
693:Computer libraries
562:Calling convention
461:"Static Libraries"
406:Loader (computing)
401:Linker (computing)
369:cc main.c -lclass
266:is controversial.
198:or more generally
680:
679:
672:Year 2038 problem
437:JAR (file format)
422:External variable
313:Microsoft Windows
223:Microsoft Windows
116:
115:
108:
90:
700:
650:Language binding
533:
526:
519:
510:
504:
503:
496:
495:
479:
473:
472:
470:
468:
457:
365:
361:
352:, one could do:
351:
347:
343:
333:
329:
325:
321:
310:
302:
296:
289:external linkage
120:computer science
111:
104:
100:
97:
91:
89:
55:"Static library"
48:
24:
16:
708:
707:
703:
702:
701:
699:
698:
697:
683:
682:
681:
676:
628:
549:
543:
537:
507:
493:
491:
481:
480:
476:
466:
464:
459:
458:
449:
445:
387:
382:
376:
370:
363:
359:
356:
349:
345:
341:
338:
331:
327:
323:
319:
311:" extension on
308:
303:" extension on
300:
294:
272:
240:
219:
200:dependency hell
187:
112:
101:
95:
92:
49:
47:
37:
25:
12:
11:
5:
706:
704:
696:
695:
685:
684:
678:
677:
675:
674:
669:
664:
663:
662:
652:
647:
642:
636:
634:
633:Related topics
630:
629:
627:
626:
621:
616:
611:
606:
604:Opaque pointer
601:
596:
591:
586:
581:
580:
579:
569:
564:
559:
553:
551:
545:
544:
538:
536:
535:
528:
521:
513:
506:
505:
474:
446:
444:
441:
440:
439:
434:
429:
424:
419:
413:
411:Shared library
408:
403:
398:
393:
386:
383:
380:
374:
368:
364:/usr/local/lib
354:
336:
271:
268:
264:static linking
256:linking loader
239:
236:
218:
215:
186:
183:
124:static library
114:
113:
28:
26:
19:
13:
10:
9:
6:
4:
3:
2:
705:
694:
691:
690:
688:
673:
670:
668:
665:
661:
658:
657:
656:
653:
651:
648:
646:
643:
641:
638:
637:
635:
631:
625:
622:
620:
617:
615:
612:
610:
607:
605:
602:
600:
597:
595:
594:Name mangling
592:
590:
587:
585:
582:
578:
575:
574:
573:
570:
568:
565:
563:
560:
558:
555:
554:
552:
546:
541:
534:
529:
527:
522:
520:
515:
514:
511:
502:
501:
490:on 2001-06-05
489:
485:
478:
475:
462:
456:
454:
452:
448:
442:
438:
435:
433:
430:
428:
425:
423:
420:
417:
414:
412:
409:
407:
404:
402:
399:
397:
394:
392:
389:
388:
384:
379:
373:
367:
353:
335:
316:
314:
307:systems and "
306:
298:
291:
290:
285:
281:
277:
269:
267:
265:
261:
257:
253:
249:
245:
237:
235:
232:
228:
224:
216:
214:
212:
207:
203:
201:
197:
192:
184:
182:
180:
176:
175:address space
172:
169:or loaded at
168:
164:
160:
156:
152:
149:
145:
141:
137:
133:
129:
125:
121:
110:
107:
99:
88:
85:
81:
78:
74:
71:
67:
64:
60:
57: –
56:
52:
51:Find sources:
45:
41:
35:
34:
29:This article
27:
23:
18:
17:
584:Machine code
576:
499:
498:
492:. Retrieved
488:the original
477:
465:. Retrieved
391:Static build
378:instead of:
377:
371:
357:
339:
317:
287:
273:
263:
248:object files
241:
220:
210:
208:
204:
188:
163:object files
158:
155:static build
132:compile-time
127:
123:
117:
102:
96:October 2013
93:
83:
76:
69:
62:
50:
38:Please help
33:verification
30:
619:System call
599:Object code
550:conventions
427:Object file
418:(DLL, .dll)
322:from files
258:(e.g., the
148:stand-alone
144:object file
614:Relocation
567:Call stack
494:2013-08-31
443:References
432:Prebinding
360:libclass.a
320:libclass.a
167:executable
151:executable
66:newspapers
557:Alignment
467:3 October
305:Unix-like
227:Unix-like
173:into the
687:Category
385:See also
350:class3.o
346:class2.o
342:class1.o
332:class3.o
328:class2.o
324:class1.o
252:run time
196:DLL Hell
171:run-time
136:compiler
660:dynamic
572:Library
358:or (if
297:keyword
80:scholar
667:Loader
655:Linker
577:static
548:Parts,
463:. TLDP
348:, and
295:static
278:or in
244:linker
159:static
146:and a
140:linker
82:
75:
68:
61:
53:
542:(ABI)
254:by a
87:JSTOR
73:books
469:2013
309:.lib
122:, a
59:news
280:C++
260:X11
221:On
126:or
118:In
42:by
689::
497:.
450:^
366:)
344:,
330:,
326:,
315:.
301:.a
138:,
532:e
525:t
518:v
471:.
276:C
109:)
103:(
98:)
94:(
84:·
77:·
70:·
63:·
36:.
Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.