Manage the Pre-Compiled Libraries

This section requires embedXcode+.

The pre-compiled libraries allow to share the functionalities of a library without disclosing the source code.

The only limitation with pre-compiled libraries is, they are only valid for the board or MCU they have been compiled against.

They can't be used with another board or MCU. embedXcode includes a mechanism to check the consistency of a pre-compiled library based on an external board file.

The pre-compiled libraries are located on the main folder of the project. For more information on where to locate the pre-compiled libraries,

Generate Pre-Compiled Libraries

Before generating a pre-compiled library from a local library,

  • Check the header and code files are inside a sub-folder

In the example below, LocalLibrary.h and LocalLibrary.cpp are inside the sub-folder LocalLibrary.

Local library in embedXcode and in the Finder
To generate a pre-compiled library,

  • Select the Archive target and launch it.

In the library sub-folder, the new file LocalLibrary.a has been created: this is the pre-compiled library. The code files have been renamed, here LocalLibrary.cpp into LocalLibrary._cpp.

The additional file .board gives the board or MCU the library has been compiled against, here arduino_zero_native.

Pre-compiled library generated in embedXcode and in the Finder

To share the library,

  • Just take the header files and the pre-compiled library, here LocalLibrary.h and LocalLibrary.a.

However, keep the renamed code source within the project, here LocalLibrary._cpp, should you wish to edit it later on.

The Distribute target includes the pre-compiled libraries and excludes the renamed code source files, here LocalLibrary.a but not LocalLibrary._cpp.

The distribution for a pre-compiled library

Remember this pre-compiled library is only valid for the board or MCU it has been compiled against. Do not use it with another board or MCU.

For more information about the Distribute target,

Remove Pre-Compiled Libraries

Before removing a pre-compiled library and return to the initial code file,

  • Check the header and modified code files are inside a sub-folder.

In the example below, the sub-folder LocalLibrary contains LocalLibrary.h and LocalLibrary._cpp.

Pre-compiled library in embedXcode and in the Finder
To remove a pre-compiled library and return to initial code files,

  • Select the Unarchive target and launch it.

In the library sub-folder, the pre-compiled library LocalLibrary.a has been removed, as well as the additional file .board. The code file has been restored, here LocalLibrary.cpp from LocalLibrary._cpp.

Local library in embedXcode and in the Finder

For more information on where to locate the pre-compiled libraries,

Use Pre-Compiled Libraries

embedXcode+ provides the LOCAL_LIBS_LIST variable to manage the pre-compiled libraries.

The logic is the same as for the local libraries when they are placed in folders.

The LOCAL_LIBS_LIST option allows to select the folders of the pre-compiled libraries.

# List local libraries here
#
LOCAL_LIBS_LIST = LocalLibrary

By default, LOCAL_LIBS_LIST is set to empty and includes all the pre-compiled libraries.

Manage Pre-Compiled Libraries Errors

There are two error messages specific to pre-compiled libraries.

Tow checks are performed, the first about the .board file and the second on the consistency with the selected board.

The following error is raised when a .board file is missing for a pre-compiled library.

  • Generate the pre-compiled libraries for the selected board again.

The following error is raised if the .board file is not consistent with the selected board.

In the example below, the pre-compiled library targets the Arduino Uno board but the selected board is an Arduino Zero.

  • Generate the pre-compiled libraries for the selected board again.