Take the 2-minute tour ×


gcc source-file

I think it is dynamic but I'm not sure. Is it system dependent?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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).

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer


