<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I think you need to use Pd's c_externdir method to determine the
extern's path. This is basicaly how I opened a .so in an external:<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<tt>void *my_extern_tilde_new(t_symbol *s, int argc, t_atom *argv)</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> // creates the object</tt><tt><br>
</tt><tt> t_my_extern *x = (t_my_extern *)pd_new(my_extern_class);</tt><tt><br>
</tt><tt><br>
</tt><tt> // using Pd's open_via_path to find myextern, and from
there my_other_lib.so</tt><tt><br>
</tt><tt> </tt><tt>char *externdir =
myextern_class->c_externdir->s_name</tt><tt>;</tt><tt><br>
</tt><tt> x->my_other_lib = dlopen(externdir, RTLD_NOW |
RTLD_LOCAL);</tt><tt><br>
</tt><tt>...</tt><br>
<br>
Joel<br>
<br>
<div class="moz-cite-prefix">On 01/09/2015 03:34 PM, David Medine
wrote:<br>
</div>
<blockquote cite="mid:54B04955.5090403@ucsd.edu" type="cite">I am
writing an extern that uses a 3rd party shared object library. I
keep getting a
<br>
"cannot open shared object file: No such file or directory"
<br>
posted to the Pd console when I load the extern. The library is
linking properly in my makefile (as far as I can tell) and the .so
file that I want the extern to load is in the same folder as the
extern. I have also put the path to the unfound library in Pd's
path list.
<br>
<br>
I have also compiled a different, plain old dylib/shared
object/dll using this very same library for use in python and it
works perfectly. I've also written C and C++ programs that link to
this library at run time and they work perfectly too. Does anybody
have any idea why Pd hates it?
<br>
<br>
I have also done dynamic loading successfully in a Pd extern using
the sphinx library. The only difference there was that there the
sphinx libraries were installed in a standard library directory
(ie /usr/lib or something like that) . I can't try to do this
right now because I don't have su rights on the computer I am
using. My understanding, though, is that linux should be searching
for dynamic libraries in the directory that the parent application
is in. So I also tried putting my unfound library in
pd-0-whatever/bin. No joy.
<br>
<br>
I have tried compiling using gcc and g++ on linux. I've also tried
to link with those compilers as well as ld (which is called by
those compilers if you link with them). I haven't tried any other
OSs yet.
<br>
<br>
Thanks in advance,
<br>
David
<br>
<br>
_______________________________________________
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
<br>
UNSUBSCRIBE and account-management ->
<a class="moz-txt-link-freetext" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a>
<br>
</blockquote>
<br>
</body>
</html>