[erlang-questions] How to load a port driver which itself uses a shared library?

Diptansu Das <>
Fri May 15 16:20:20 CEST 2015


I figure out my problem. I wasn't putting a -l<libname> in the link line,
so of course it didn't know which library to lookup. Idiotic.
Thanks for the help everyone. The tip about running ldd got me thinking.
Thanks.

On Fri, May 15, 2015 at 9:30 AM, Diptansu Das <> wrote:

>  I used the erl_ddll:format_error/1 and that said that one of the
> functions (foo) was undefined. The function doo is actually in another .so
> file in the same directory (lets call that foo.so). Weirdly, when I run ldd
> on my driver.so it does not show any dependency on this foo.so . I am
> compiling the driver by using:
>  g++ -o simple_drv.so -i$ERL_TOP/erts/emulator/beam -fpic -shared
> simple_drv.cpp
>
> On Fri, May 15, 2015 at 3:41 AM, Sergej Jurečko <>
> wrote:
>
>> To check shared library paths that your driver is looking for:
>>
>> Linux: ldd your_driver.so
>> Osx: otool -L your_driver.so
>>
>>
>> Sergej
>>
>> On Fri, May 15, 2015 at 4:57 AM, Diptansu Das <> wrote:
>>
>>> I need to create a port driver which will need to link against some
>>> other shared library. When I try to load the driver I get an {error,
>>> {open_error, -10}}. I tracked this down to the call to the shared library
>>> functions. If I comment out the calls to the shared library it loads fine.
>>> It seems the erl_ddll loader cannot load a driver if it links to a shared
>>> library... Or maybe there is some other way to accomplish this?
>>> In case I cannot create a normal dynamically loaded port driver, how can
>>> I statically link it to the erlang build?
>>> Thanks,
>>> D
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150515/d83bcc09/attachment.html>


More information about the erlang-questions mailing list