-
Notifications
You must be signed in to change notification settings - Fork 230
Description
Hi, I'm trying to use a single rust function inside my elixir app. I followed the setup instructions according to mix rustler.new
and successfully got it working under iex
. Unfortunately, I was getting an error when doing the same for escript.build
, which is when I found out that rustler uses priv directory which is not accessible to escripts. Luckily, I came across the load_from
configuration option and tried it in my module like this:
use Rustler, otp_app: :fizzbuzz, crate: "fizzbuzz", load_from: {:fizzbuzz, "/Users/maheep/Downloads/native/libfizzbuzz"}
Unfortunately, all it does is append the path to Application.app_dir output. Here's the problematic line in rustler.ex
:
load_path =
otp_app
|> Application.app_dir(path)
|> to_charlist()
which I changed to:
load_path =
path
|> to_charlist()
Doing this change allows me to specify fully custom load_from
paths and gets things working for me.
MY QUESTION: Is load_from
the correct option to use in my case? If so, do I have any other alternative (I don't think its a good idea to mess with a dependency's code).
MY OS: macOS 13.4.1 Ventura