You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,7 @@ On-line help is available via the `help` sub-command:
82
82
[<input-file>]+ is a list of one or more input files,
83
83
and <options> are among the following:
84
84
[--prune|-p] Prune dependencies
85
+
[--lib|-l] Create a library avm, with no start module
85
86
[--start|-s <module>] Start module
86
87
[--remove_lines|-r] Remove line number information from AVM files
87
88
@@ -135,11 +136,21 @@ Note that beam files specified are stripped of their path information, inside of
135
136
136
137
#### Start Entrypoint
137
138
138
-
If you are building an application that provides a start entrypoint (as opposed to a library, suitable for inclusion in another AVM file), then at least one beam module in an AVM file must contain a `start/0` entry-point, i.e., a function called `start` with arity 0. AtomVM will use this entry-point as the first function to execute, when starting.
139
+
If you are building an application that provides a start entrypoint (as opposed to a library,
140
+
suitable for inclusion in another AVM file), then at least one beam module in an AVM file must
141
+
contain a `start/0` (i.e., a function called `start` with arity 0) or `main/1` entry-point. AtomVM
142
+
will use this entry-point as the first function to execute, when starting.
139
143
140
-
> Note. It is conventional, but not required, that the first beam file in an AVM file contains the `start/0` entry-point. AtomVM will use the first BEAM file that contains an exported `start/0` function as the entry-point for the application.
144
+
When explicitly setting the `--start` module no other module will be tagged as an entrypoint, even
145
+
if multiple modules export `start/0`.
141
146
142
-
If your application has multiple modules with exported `start/0` functions, you may use the `--start <module>` (alternatively, `-s <module>`) option to specify the module you would like placed first in your AVM file. The `<module>` parameter should be the module name (without the `.beam` suffix, e.g., `main`).
147
+
> Note. It is conventional, but not required, that the first beam file in an AVM file contains the
148
+
`start/0` entry-point.
149
+
150
+
If your application has multiple modules with exported `start/0` functions, or you are creating an
151
+
escript with a `main/1`, you may use the `--start <module>` (alternatively, `-s <module>`) option
152
+
to specify the entrypoint module. The `<module>` parameter should be the module name (without the
153
+
`.beam` suffix, e.g., `main`).
143
154
144
155
A previously created AVM file file may be supplied as input (including the same file specified as output, for example). The contents of any input AVM files will be included in the output AVM file. For example, if you are building a library of BEAM files (for example, none of which contain a `start/0` entry-point), you may want to archive these into an AVM file, which can be used for downstream applications.
145
156
@@ -149,6 +160,12 @@ In addition, you may specify a "normal" (i.e., non-beam or non-AVM) file. Norma
149
160
150
161
> Note. It is conventional in AtomVM for normal files to have the path `<module-name>/priv/<file-name>`.
151
162
163
+
#### Creating Libraries
164
+
165
+
Libraries can be packed using the `--lib` (alternatively, `-l`) option. This will create a packed
166
+
avm archive without auto selecting a start module, even if one or more of the included modules
167
+
export `start/0`.
168
+
152
169
#### Pruning
153
170
154
171
If you specify the `--prune` (alternatively, `-p`) flag, then `packbeam` will only include beam files that are transitively dependent on the entry-point beam. Transitive dependencies are determined by imports, as well as use of an atom in a module (e.g, as the result of a dynamic function call, based on a module name).
@@ -241,6 +258,7 @@ Alternatively, you may specify a set of options with the `packbeam_api:create/3`
241
258
| Key | Type | Default | Description |
242
259
|-----|------|---------|-------------|
243
260
|`prune`|`boolean()`|`false`| Specify whether to prune the output AVM file. Pruned AVM files can take considerably less space and hence may lead to faster development times. |
261
+
|`lib`|`boolean()`|`false`| Create a library (no entrypoint) |
244
262
|`start`|`module()`| n/a | Specify the start module, if it can't be determined automatically from the application. |
245
263
|`application`|`module()`| n/a | Specify the application module. The `<application>.app` file will be encoded and included as an element in the AVM file with the path `<module>/priv/application.bin`|
246
264
|`include_lines`|`boolean()`|`true`| Specify whether to include line number information in generated AVM files. |
0 commit comments