dlopen - Calling function by name using dlsym in iOS -


can't call function name in ios? have c function called getstring. calling follows:

void* handle = dlopen(null, rtld_now); if (handle) { fp func = dlsym(handle, "getstring"); if (!func)     responsefield.text = [nsstring stringwithutf8string:dlerror()]; else {     char* tmpstr = func();     responsefield.text = [nsstring stringwithutf8string:tmpstr];         } } else { responsefield.text = [nsstring stringwithutf8string:dlerror()]; } 

when executes, responsefiled.text set dlsym(...): symbol not found. means dlopen works not dlsym. dumped symbols in binary using nm , saw _getstring present. checked manual dlsym , says should not add underscore name. adding not solve issue anyway. doing wrong?

i had asked similar question here calling functions name in objective-c , tried on mac following answers, problem seems specific ios.

i believe problem dlopen not supported on ios, if statically link libraries. should able use

dlsym(rtld_self, "getstring"); 

because rtld_self means 'start looking in image called dlsym'. based on how you're using dlopen() should accomplish same thing.


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -