Generating wrapper module
Nimler can generate Erlang or Elixir wrapper at compile time.
Relevant nim compile flags:
-d:nimlerGenWrapper
- generate elixir wrapper
-d:nimlerGenWrapperForce
- potentially overwrite existing wrapper of the same
-d:nimlerWrapperRoot=/myroot
- absolute root directory of the generated wrapper
-d:nimlerWrapperFilename=Wrapper.ex
- file name of the generated wrapper
-d:nimlerWrapperLoadInfo={a: 123}
- module load info
-d:nimlerWrapperType=elixir
- possible values erlang
, elixir
. Note: to
generate erlang wrappers, also remove any Elixir.xxxx
prefixes in the call to
exportNifs() template
The name of the target Elixir module, and its filename, is based on the module name as exported from nimler and not the name of the .nim source file. export_nifs("Elixir.NumberAdder", ...
will produce module named NumberAdder
.
The target directory is the same as the .nim source. i.e., -o nim compile flag affects the destination of generated Elixir module. Override with -d:nimlerWrapperRoot
.