A new version of the Advanced Resource Embedder is now available. The tool allows to embed files in binaries by producing C, Ada or Go source files that contain the file to embed.
By Stephane Carrez2022-01-23 09:04:42
A new version of the Advanced Resource Embedder is now available. The tool allows to embed files in binaries by producing C, Ada or Go source files that contain the file to embed.
The new release contains the following fixes:
Since the previous version, Fabien Chouteau asked to be able to use an Ada system type to represent a binary content. This is now possible by using the following XML extract for the description to tell the resource embedder how to integrate the file and generate the Ada source code:
<package>
<resource name='Resources.Help'
format='binary'
type='access constant System.Storage_Elements.Storage_Array'>
<install mode='copy'>
<fileset dir="help">
<include name="**/*.txt"/>
</fileset>
</install>
</resource>
...
</package>
With the above description, the Ada code generator produces the following package specification:
with System.Storage_Elements;
package Resources.Help is
type Content_Access is access constant System.Storage_Elements.Storage_Array;
type Name_Access is access constant String;
type Name_Array is array (Natural range <>) of Name_Access;
Names : constant Name_Array;
function Get_Content (Name : String)
access constant System.Storage_Elements.Storage_Array;
private
...
end Resources.Help;
This example is available in Embedding help and documentation in Ada (binary). If you prefer to use String instead of a Storage_Array, have a look at the Embedding help and documentation in Ada. Both examples are similar but they are exposing the file using different Ada types.
To install the tool, follow the instructions given in the initial announcement: Advanced Resource Embedder for Ada, C and Go.
If you want to know more about the tool, have a look at its documentation:
and if you have ideas for improvements, fork the project and submit a pull request!
Add a comment
To add a comment, you must be connected. Login