Reputation:
Ex:
gcc source-file
I think it is dynamic but I'm not sure. Is it system dependent?
Upvotes: 6
Views: 2532
Reputation: 16045
It is technically system dependent, but on most systems you're likely to develop for, the answer is "dynamic".
A few systems (mostly very old, embedded, or otherwise specialized) do not support dynamic linking at all, but most developers are unlikely to care about those systems. On those systems, the linker will of course default to linking statically (unless whoever did the port screwed up :)).
Some systems also do not offer static versions of their standard libraries, so you can't statically link them.
On many systems (especially any typical Linux system), you probably have a utility called ldd
. You can use ldd <file>
to check if it's dynamically linked to the standard library (assuming you know for sure what the library is called, it's usually libc
though).
Upvotes: 5
Reputation: 224904
Most linkers prefer dynamic libraries to static when linking, but normally they have flags to explicitly specify the behaviour. It's definitely system dependent - check your linker documentation for details.
Upvotes: 1