Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One thing to check that doesn't seem to have been mentioned yet is that the exact name 'create' must be exported from your shared library.</p> <p>Try</p> <pre><code>nm --dynamic --defined-only RollDice.so | grep create </code></pre> <p>If you get no matches, or get some mangled symbol for 'create', then your dlsym(..., "create") call is bound to fail.</p> <p>Also, once you solve the name lookup issues, you should seriously consider adding RTLD_GLOBAL to your dlopen flags. dlopen defaults to RTLD_LOCAL, which interacts poorly with C++ shared libraries w.r.t. RTTI, exceptions, typeinfo, etc. RTLD_GLOBAL will lead to fewer surprises.</p> <p>Also consider using RTLD_NOW rather than RTLD_LAZY. If there are symbols in your plugin library that were not resolvable at dlopen time, you have just created a ticking time bomb. Better to know at dlopen time whether the library was able to satisfy all of the required references or not.</p> <p>edit:</p> <p>I overlooked that checking for 'create' with 'nm' had already been suggested. However the dlopen flags advice is still important.</p> <p>Also, your compilation line looks very odd to me, especially that you are including the RollDice.h on the build line, rather than the RollDice.cpp file.</p> <p>In addition, including .cpp files in other .cpp files is not standard practice.</p> <p>I'd suggest eliminating the .cpp to .cpp inclusion, and then compiling the various .cpp files separately with -o, then merging them into a shared library:</p> <pre><code>g++ -g -fPIC -c -o RollDice.o RollDice.cpp g++ -g -fPIC -c -o IPluginFunctions.o IPluginFunctions.cpp g++ -g -fPIC -c -o IPlugins.o IPlugins.cpp g++ -g -fPIC -shared -o RollDice.so RollDice.o IPluginFunctions.o IPlugins.o </code></pre>
 

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