{{fbdoc item="title" value="Compiler Option: -static"}}----
Prefer static libraries over dynamic ones when linking

{{fbdoc item="syntax"}}##
		""-static""
##
{{fbdoc item="desc"}}
	When creating an executable or a shared library/DLL, the ##-static## compiler option can be used to tell the compiler to prefer linking against static libraries rather than shared libraries/DLLs. That way, if the linker finds both static and shared versions of a library, it will use the static version, rather than defaulting to the shared version.
	
	Installing the proper static libraries and then using ##-static## can be used to avoid some or all dependencies on shared libraries.

{{fbdoc item="target"}}
	- On Linux & co it is possible to create purely statically linked executables, because static versions of the system libraries used by ""FreeBASIC"" are available.
	- On Windows, there are no static versions of the system libraries, but ##-static## can still be useful to decide between static library or DLL versions of other libraries, if both are installed.

{{fbdoc item="see"}}
	- [[CompilerCmdLine|Using the Command Line]]

{{fbdoc item="back" value="CatPgCompOpt|Compiler Options"}}