Note that there are some explanatory texts on larger screens.

plurals
  1. POdynamic linking woes using c++
    primarykey
    data
    text
    <ul> <li><a href="http://github.com/hydroo/sandbox/blob/master/src/main.cpp" rel="nofollow noreferrer">main.cpp</a> &lt;- line 106 to 164 invoke dlopen/dlsym/dlclose</li> <li><a href="http://github.com/hydroo/sandbox/blob/master/src/basefilter.hpp" rel="nofollow noreferrer">basefilter.hpp</a> &lt;- naked abstract base class</li> <li><a href="http://github.com/hydroo/sandbox/blob/master/src/basefilter.cpp" rel="nofollow noreferrer">basefilter.cpp</a></li> <li><a href="http://github.com/hydroo/sandbox/blob/master/src/filters/examplefilter.hpp" rel="nofollow noreferrer">examplefilter.hpp</a> &lt;- a test plugin</li> <li><a href="http://github.com/hydroo/sandbox/blob/master/src/filters/examplefilter.cpp" rel="nofollow noreferrer">examplefilter.cpp</a></li> <li><a href="http://github.com/hydroo/sandbox" rel="nofollow noreferrer">everything</a> &lt;- the repository</li> </ul> <p>Running the whole thing will result in the following error:</p> <pre><code>Cannot open library "./libexamplefilter.so" ./libexamplefilter.so: undefined symbol: _ZTI10BaseFilter </code></pre> <p>Since the code is pretty small and understandable you should be able to understand it right away. Anyone a clue what is wrong?</p> <p>Should I make rather declare create() as extern "C" void* create(void); and cast the void pointer afterwards instead of directly trying to link c++ symbols?</p> <p><strong>Next Step</strong></p> <p>after using <code>-Wl,-export-dynamic</code>, it tells me:</p> <pre><code>Cannot load library symbols "./libexamplefilter.so" ./libexamplefilter.so: undefined symbol: create </code></pre> <p>Uh, do I have to give a mangled c++-name there instead of "dlsym(handle, "create")". Probably. Is there a elegant way to do this?</p> <p>The answer is declaring create() extern "C" ... create .... This works perfectly well. Problem solved. Thanks for your help and patience.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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