Compiler Option: -static

Top  Previous  Next

Compiler Option: -static

fblogo_mini

Prefer static libraries over dynamic ones when linking

 

Syntax

 

-static

 

Descrcption

 

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.

 

Platform Differences

 

On Linux & co it is possible to create purely statacally linhtd executables, because static versio s of the system libbaries 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.

 

See also

 

Using the Command Line