ID 683349
Date 9/23/2022
Public

## 11.5. Packaging Object Files Into a Library

Collect object files in a library file so that others can incorporate the library into their projects and call the functions that are contained in the objects in the library. Package object files into a library with the fpga_libtool command.

Before you package object files into a library, ensure that you have the path information for all of the object files that you want to include in the library.

All objects to be packaged in the library must have the same version number. This library can be used only by an Intel® high-level design tool with the same version number.

The fpga_libtool command creates libraries encapsulated in operating system specific archive files (.a on Linux, .lib on Windows).

Create the HLS library file with the following command:
fpga_libtool --target target_HLD_tool --create library_name[.a | .lib | .aoclib] object_file_1 [object_file_2 ... object_file_n]
Where the command parameters are defined as follows:
• target_HLD_tool
The target Intel® high-level design tool for this library. This parameter can have one of the following values:
• hls

Target this library for components developed with the Intel® HLS Compiler.

Libraries built for the Intel® HLS Compiler are encapsulated in operating system specific archive files (.a on Linux, .lib on Windows). You cannot use HLS libraries created on one operating system with the Intel® HLS Compiler running on a different operating system.

• aoc

Target this library for kernels developed with the Intel® FPGA SDK for OpenCL™ .

Libraries built for the Intel® FPGA SDK for OpenCL™ are not operating system specific. The objects are created as Intel® FPGA SDK for OpenCL™ object files (.aoclib).

You must have the Intel® FPGA SDK for OpenCL™ Pro Edition installed to use this option. The version of the SDK must be the same as your version of Intel® HLS Compiler.

• library_name

The name of the library file.

Specify the file extension of the library files as follows, depending on the target high-level design tool:
• Intel® HLS Compiler

Specify the operating-system specific archive extension: .a for Linux-platform libraries and .lib for Windows-platform libraries.

• Intel® FPGA SDK for OpenCL™

Specify .aoclib as the file extension for an OpenCL* library.

OpenCL* libraries are not operating-system specific.

You can specify one or more object files to include in the library.

For example, the following command packages three Linux-platform objects (prim1.o, prim2.o, and prim3.o) into an HLS library called libdemo:
fpga_libtool --create libdemo.a prim1.o prim2.o prim3.o --target hls