Problem
I have created my own Dynamically Linked Library (DLL) and I am using dlopen(S) with the RTLD_LAZY flag to open the library in a program.
When I run the program I get the error:
Error while loading <dll_name.so>: dynamic linker: test: relocation error: symbol not found: <symbol_name>
Cause
Your DLL was not built with Position Independent Code.
Solution
Compile your DLL using the -Kpic cc(CP) compiler switch as follows:
cc -o dll_name.o -Kpic -b elf -c dll_name.c
cc -o dll_name.so -G dll_name.owhere dll_name.c is the original Dynamically Linked Library source and dll_name.so is the position independent DLL.