# shared

Tells the compiler to produce a dynamic shared object instead of an executable.

## Syntax

Linux: | -shared

macOS: | None

Windows: | None

## Arguments

None

## Default

OFF | The compiler produces an executable.

## Description

This option tells the compiler to produce a dynamic shared object (DSO) instead of an executable. This includes linking in all libraries dynamically and passing -shared to the linker.

You must specify option fpic for the compilation of each object file you want to include in the shared library.

### Note

This option only applies to host compilation. When offloading is enabled, it does not impact device-specific compilation. Offloading can only be enabled when using ifx.

## IDE Equivalent

None

## Alternate Options

None

Parent topic: Linking or Linker Options

## See Also

dynamiclib compiler option
fpic compiler option
Xlinker compiler option