How do I compile a dll/shared library with undefined references?
Hi. I'm new to C (was using C++) and dynamically linked libraries. I'm a self-taught programmer, so if I get any of the terms wrong, so if I'm asking a question which is unbelievably simple to you, please forgive me.
I want to create a shared library which call code defined in another shared library, but I don't want to link them together at link-time.
According to this document (http://www.samspublishing.com/articl...p?p=22435&rl=1 -- 2nd paragraph from bottom), I can have a foo() function in DLL_1 which calls bar() in DLL_2, without linking them explicitly, by dlopen-ing them in my main() program using the RTLD_GLOBAL argument. However, I can't figure out how to compile DLL_1, since it contains an undefined reference to bar().
I've tried all the compiler/linker flags I could find (--undefined-symbol=ignore-all, --allow-shlib-undefined, etc), and I've searched the forum for answers, but I'm still stuck. Does anyone have any pointers? I'm using GCC (Cygwin).