Visible to Intel only — GUID: GUID-7EC44EC6-4E81-430A-BF0E-F8A92003F5D0
Visible to Intel only — GUID: GUID-7EC44EC6-4E81-430A-BF0E-F8A92003F5D0
Pass Options to the Linker
Specify Linker Options
This topic describes the options that let you control and customize linking with tools and libraries and define the output of the linker.
Linux
This section describes options specified at compile-time that take effect at link-time to define the output of the ld linker. See the ld man page for more information on the linker.
Option |
Description |
---|---|
-Ldirectory |
Instruct the linker to search directory for libraries. |
-Qoption,tool,list |
Passes an argument list to another program in the compilation sequence, such as the assembler or linker. |
-shared |
Instructs the compiler to build a Dynamic Shared Object (DSO) instead of an executable. |
-shared-libgcc |
-shared-libgcc has the opposite effect of -static-libgcc . When it is used, the GNU standard libraries are linked in dynamically, allowing the user to override the static linking behavior when the -static option is used.
NOTE:
Note: By default, all C++ standard and support libraries are linked dynamically. |
-shared-intel |
Specifies that all Intel-provided libraries should be linked dynamically. |
-static |
Causes the executable to link all libraries statically, as opposed to dynamically. When -static is not used:
|
-static-libgcc |
This option causes the GNU standard libraries to be linked in statically. |
-static-intel |
This option causes Intel-provided libraries to be linked in statically. It is the opposite of -shared-intel. |
-Wl,optlist |
This option passes a comma-separated list (optlist) of options to the linker. |
-Xlinker val |
This option passes a value (val), such as a linker option, an object, or a library, directly to the linker. |
Windows
This section describes options specified at compile-time that take effect at link-time.
You can use the link option to pass options specifically to the linker at compile time. For example:
icx a.cpp libfoo.lib /link -delayload:comct132.dll
In this example, the compiler recognizes that libfoo.lib is a library that should be linked with a.cpp, so it does not need to follow the link option on the command line. The compiler does not recognize -delayload:comct132.dll, so the link option is used to direct the option to the linking phase. On C++, you can use the Qoption option to pass options to various tools, including the linker. You can also use #pragma comment on C++ to pass options to the linker. Linker options do not work for SYCL kernels, but they do work for host code (including pragmas for linker options). For example:
#pragma comment(linker, "/defaultlib:mylib.lib")
OR
#pragma comment(lib, "mylib.lib")
Both examples instruct the compiler to link mylib.lib at link time.