I am trying to load an extension to sqlite3 for use within iPhone application objective-c code. I successfully compiled the c file of new functions into a dylib named libsqlitefunctions.dylib. Here is where I am a bit lost. I call sqlite3_load_extension as follows:
char *error = sqlite3_malloc(MAX_SQLITE_ERROR_MESSAGE_SIZE); const char *library = [@"libsqlitefunctions.dylib" UTF8String];
if (sqlite3_load_extension(database, library, 0, &error) != SQLITE_OK) { message = [NSString stringWithFormat:@"%s", error]; }
sqlite3_free(error);
No matter what I do, I get the error: dlopen(libsqlitefunctions.dylib, 10): image not found
I tried:
- indicating the fully qualified path to the dylib
- indicating a relative path
- not indicating a path (as shown above)
- adding the dylib as a framework
- adding the .c file to my project and compiling it into a .o file and then trying to load it
Please note that this is not an entry point problem, since I pass 0 as that arg. This will force the dylib to load by calling an init function defined in the dylib. I do not even get to that point.
I am pretty much a newbie compared to the rest of you guys and feel that I am probably lacking an understanding of how libraries are loaded.
I would really appreciate any ideas since the ability to make use of the functions in this library is important to the functionality of my app. Thank you all in advance.