Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Read the <a href="http://man7.org/linux/man-pages/man3/dlopen.3.html" rel="noreferrer">dlopen(3)</a> man page (e.g. by typing <code>man dlopen</code> in a terminal on your machine):</p> <blockquote> <p>If filename contains a slash ("/"), then it is interpreted as a (relative or absolute) pathname. Otherwise, the dynamic linker searches for the library as follows (see ld.so(8) for further details):</p> </blockquote> <pre><code> o (ELF only) If the executable file for the calling program contains a DT_RPATH tag, and does not contain a DT_RUNPATH tag, then the directories listed in the DT_RPATH tag are searched. o If, at the time that the program was started, the environment variable LD_LIBRARY_PATH was defined to contain a colon-separated list of directories, then these are searched. (As a security measure this variable is ignored for set-user-ID and set-group-ID programs.) o (ELF only) If the executable file for the calling program contains a DT_RUNPATH tag, then the directories listed in that tag are searched. o The cache file /etc/ld.so.cache (maintained by ldconfig(8)) is checked to see whether it contains an entry for filename. o The directories /lib and /usr/lib are searched (in that order). </code></pre> <p>So you need to call <code>dlopen("./libLibraryName.so", RTLD_NOW)</code> -not just <code>dlopen("libLibraryName.so", RTLD_NOW)</code> which wants your plugin to be in your <code>$LD_LIBRARY_PATH</code> on in <code>/usr/lib/</code> etc .... - or add <code>.</code> to your <code>LD_LIBRARY_PATH</code> (which I don't recommend for security reasons).</p> <p>As <a href="https://stackoverflow.com/a/17715977/841108">Jhonnash answered</a> you should use and display the result of <code>dlerror</code> when <code>dlopen</code> (or <code>dlsym</code>) fails:</p> <pre><code> void* dlh = dlopen("./libLibraryName.so", RTLD_NOW); if (!dlh) { fprintf(stderr, "dlopen failed: %s\n", dlerror()); exit(EXIT_FAILURE); }; </code></pre> <p>You might want to read some books like <a href="http://advancedlinuxprogramming.com/" rel="noreferrer">Advanced Linux Programming</a> to get some knowledge about Linux system programming in general.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload