Open erlanger opened 6 years ago
Do you mean this to be used only when --target
is specified, or for all cases?
It would simplify the nif/port finding code (in erlang) if it is used for all cases.
I don't think that should be default behavior, but a flag to turn that on would be sensible. Perhaps in conjunction with an additional option to build multiple architectures in one go. The reasons to make it non-default are:
I can see the first two points; it's okay to make it optional with a flag to turn it on.
I would suggest to change the directory structure in
priv/crates
to include the architecture. For example:The problem would be to decide which architecture string to use, the erlang one returned by
erlang:system_info(system_architecture)
or the rust one used by cargo with--target
.The erlang one has the advantage that it would be easier to find the port/nif from the erlang code when it is time to load the nif or open the port.
The rust one is easier to obtain simply from
--target
but some way needs to be provided to map from the rust architectures to the erlang architecture in order to find the .so or binary at runtime from the erlang environment.