I used dlxxx apis so that I can load a library dinamically. As you know, there are binary (as a host) and a shared library.
In the host app, there are some symbols which should be used by the shared library. However, none of other parts of the host app uses those symbols, so I need to prevent those symbols from stripping.
When I ran this test app, I got a undefined symbol runtime error. This error was "undefined symbol jpeg_write_scanlines". It didn't make sense at all. I checked if there was a symbol, "jpeg_write_scanlines" in the test app. There was "jpeg_write_scanlines" symbol. I really don't know what I'm missing.
I resolved this problem with linker option. There are both ways, one is to use -rdynamic(--export-dynamic). However, this way exposes all the symbols in the host app. So it'll increase its total binary size.
Another way is to use symbol list which let linker know what symbols need to be exposed or holded by the host app. In my case, I used "-Wl,-dynamic-list,symbol-list" option.
The symbol-list file contains all the symbols.
// symbol-list (my symbol list file)
{
jpeg_std_error;
jpeg_stdio_src;
jpeg_create_compress;
jpeg_set_defaults;
jpeg_set_quality;
jpeg_stdio_dest;
jpeg_start_compress;
jpeg_destroy_compress;
jpeg_write_scanlines;
jpeg_finish_compress;
jpeg_destroy_compress;
};