# Creating a Library from IPO Objects

## Linux*

Libraries are often created using a library manager such as xiar for Linux* or xilib for Windows*. Given a list of objects, the library manager will insert the objects into a named library to be used in subsequent link steps.

Example
    xiar cru user.a a.o b.o

The above command creates a library named user.a containing the a.o and b.o objects.

Using xiar is the same as specifying `xild -lib`.

## Windows Only

Create libraries using xilib or `xilink -lib` to create libraries of IPO mock object files and link them on the command line.

For example, assume that you create three mock object files by using a command similar to the following:

Example
    [invocation] /c /Qipo a.cpp b.cpp c.cpp

Where [`invocation`] is `icx` for C++ or `dpcpp-cl` for DPC++.

Further assume a.obj contains the main subprogram. You can enter commands similar to the following to create a library.

Example
    xilib -out:main.lib b.obj c.obj
    // or
    xilink -lib -out:main.lib b.obj c.obj

You can link the library and the main program object file by entering a command similar to the following:

Example
    xilink -out:result.exe a.obj main.lib

Parent topic: Interprocedural Optimization (IPO)

## See Also

static compiler option