Reputation: 394
I currently have an application that runs on a desktop and a phone. The desktop requires a full-featured libfoo.so, but the mobile version only requires a small subset of libfoo.so. Someone else has already implemented libfoo-phone.so, and it uses the same function names as libfoo.so for the functions that it actually implements.
I am currently including libfoo-phone.h, which works as usual because its being linked against at compile time. However, when I link at runtime via dlopen, I won't be able to include the header file. Is there an easy way to make this work without a huge wrapper that makes 100's of calls to dlsym?
Upvotes: 0
Views: 549
Reputation: 823
Why link at runtime? Just link to the appropriate .so depending on the current build target (phone vs desktop). The platforms dynamic linker will load the *.so for you automatically when the executable is run, and you don't have to worry about runtime loading of a library. You can include the header, reference the symbols all you want, and there won't be any problems.
Upvotes: 2