Le Trung Thang 2011
Static link vs Dynamic link |
A Runtime library is the libraries with the features follow:
-1. Runtime library consists a collection of functions specialize in a specific target hardware.
For example: behavior of printf function in each different target hardware is different. In Intel x86 PC platform , printf will out a string to console, but in many embedded ARM boards, may be printf will out a string to serial port. So printf is a part of the runtime library.
-2. Runtime library consists a collection of functions which are only used by compiler, application developer cannot to use it.
For example: in compiling processing, compiler creates some internal functions automatically. These functions are used for some tasks as initialize zero data (__int_zero_data__), __main(),..
These functions cannot call by application developer.
-3. Runtime library consists functions that can be performed only (or are more efficient or accurate) at runtime are implemented in the runtime library.
For example: some logic errors, array bounds checking, dynamic type checking,...
Sometimes, some C/C++ compiler for embedded system can be also included the C/C++ standard library to Runtime library, too. Although, these standard libraries were packaged and shipped under static library. This is up to compiler manufacturer.
So, There can be conclusion that: In Linux environment, the Runtime library is different with the dynamic (shared) library.
Reference: http://cboard.cprogramming.com/cplusplus-programming/136855-what-runtime-library-c-cplusplus.html
above just mentioned "Runtime library consists a collection of functions...."
ReplyDelete--> it's possible if there's a global variable in library built by ourself and we reuse it for our application..
========= example =========
in library we declared below variable and used in somewhere:
int _iAmGlobalVar;
=> in our own application, we include this library, so can we reuse this variable ?
Yes. we can. I think that.
ReplyDeletewhen we "talk" the word "Functions", we implied that it included the variables :) . However, They seldom declare the variables in runtime library.
For example:
In C Standard library, They predefined 3 well-known variables are stdin, stdout and stderr. when your program start, three the variables existed.