Open shared library from library app

Disclaimer: I am unfamiliar with how rebar3 locates the various resources, so I hope this question makes sense.

I have a library app that contains an iface module. The face module loads a port driver for performing io. The library app compiles the shared object: and stores it in _build/.../libapp/priv/lib/. When I run rebar3 shell in proj_root/apps/libapp/, I am able to load the shared library using erl_ddll:load/2 without any problems. However, when I run rebar3 shell in proj_root/, I get a bad name error. I am assuming it is because running from proj_root/ hides the priv directory of library app.

Can you help me understand what is happening, and what are ways to solve this problem? I understand that what I may be doing is unconventional, so I am open to receiving conventional wisdom on how to improve my process as I am really green to Erlang.

1 Like

I figured out my problem. I wasn’t doing anything wrong in loading the shared library like I had originally thought. The problem was because another application was loading a shared library with the same name. So, my library was failing to load with a bad name error because a shared library with the same name was already loaded. :man_facepalming:

1 Like