[erlang-questions] os:putenv/2 not helping with erl_ddll:load_driver/2

Steve Vinoski vinoski@REDACTED
Wed Sep 23 01:48:33 CEST 2009


On Tue, Sep 22, 2009 at 2:38 PM, Paul Mineiro <paul-trapexit@REDACTED>wrote:

> I'm encountering a difference between os:putenv/2 and setting the
> environment variable prior to invoking Erlang.
>
> I'm trying to pick up a library that the os puts in a funny place,
> which my linked-in driver depends upon.  Manipulating the environment
> variable inside Erlang doesn't have the desired effect.
>
> Does anybody have a workaround?  I don't want to have to restart the
> emulator to install this software.
>

Assuming you're on Linux, you can't set the LD_LIBRARY_PATH after the
process is already running and have it take effect. It's only loaded at
process startup and can't be changed thereafter within the process for it to
affect that process. You might consider instead adding a runtime search path
to your driver at link-time using the -rpath ld option (or -Wl,-rpath,dir
from gcc).

--steve


More information about the erlang-questions mailing list