Manage the pre-compiled libraries¶
This section requires the embedXcode+ edition.
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. The embedXcode+ edition 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,
- Please refer to the section Locate the pre-compiled libraries .
Generate the 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
.

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
.

To share the library,
- Just take the header files and the pre-compiled library, here
LocalLibrary.h
andLocalLibrary.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
.

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,
- Please refer to Distribute the project .
Remove the 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
.

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
.

For more information on where to locate the pre-compiled libraries,
- Please refer to the section Locate the pre-compiled libraries .
Use the pre-compiled libraries¶
The embedXcode+ edition 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.