I guess your problem is, that you have to load both libraries simultaneously. You can't just link both in the executable using two -l options, because the symbol names collide. If this is the problem, dlopen if your friend.
#include <dlfcn.h>
void * handle=dlopen(filename,RTLD_NOW|RTLD_GLOBAL);
bool (*some_function)(char * name);
some_function=(bool (*)(char *))dlsym(handle,"name_of_some_function");
if (some_function("test")) {
....
} else {
....
}
Because I don't know DB2 I can't help you any further, but if this was the problem, you should now have everything to solve the problem.