Intel® FPGA SDK for OpenCL™ Pro Edition: Programming Guide

ID 683846
Date 3/28/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

11.1.1.2. Packaging Object Files into a Library File

Gather the object files into 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. To package object files into a library, use 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 that you want to package into a library must have the same version number (for example, Intel® FPGA SDK for OpenCL™ Pro Edition version 19.3). The fpga_libtool command creates libraries encapsulated in operating system-specific archive files (.a on Linux and .lib on Windows). You cannot use libraries created on one operating system with an Intel® high-level design product running on a different operating system.

Create the OpenCL library file using the following command:

fpga_libtool --target target_HLD_tool --create library_name object_file_1 [object_file_2 ... object_file_n]
Where the command parameters are defined as follows:
Table 11.  Parameters of the fpga_libtool Command
Parameter Description
target_HLD_tool
The target Intel® high-level design tool for this library. This parameter can have one of the following values:
  • 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).

  • 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 and .lib on Windows).

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® FPGA SDK for OpenCL™

    Specify .aoclib as the file extension for an OpenCL* library. OpenCL* libraries are not operating-system specific.

  • Intel® HLS Compiler

    Specify the operating-system specific archive extension:

    • .a for Linux-platform libraries.
    • .lib for Windows-platform libraries.

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 OpenCL library called libdemo:
fpga_libtool --create libdemo.a prim1.o prim2.o prim3.o --target aoc