Question

I've compiled a static library and linked both SQLCipher and OpenSSL. The full project, makefile, and compiled library can be found here:

https://github.com/anujb/SQLCipherNet

When I link the resulting library in a normal Objective-C Xcode project, the call to sqlite3_key works fine.

I've linked the same library into a MonoTouch project using:

-gcc_flags "-L${ProjectDir} -lsqlciphernet -force_load ${ProjectDir}/libsqlciphernet.a"

Then I've modified SQLite-NET to call the the key function, after every SQLite3.Open(...) function:

[DllImport("__Internal", EntryPoint = "sqlite3_key")]
public static extern Result Key(IntPtr db, string key, int keyLength);

But I get a EntryPointNotFoundException when the Key method is called. Here's the stack trace:

System.EntryPointNotFoundException has been thrown at:
at (wrapper managed-to-native) SQLite.SQLite3:Decrypt (intptr,string,int)
at SQLite.SQLiteConnection..ctor (System.String databasePath) [0x00031] in 
../SQLite.cs:108 

Obviously the stacktrace isn't particularly helpful, but I'm at a loss as to where to begin to debug this issue. Halp?

Was it helpful?

Solution

I get the same error when building your solution for "Debug|iPhoneSimulator". However your project options, for this configuration, do not include the gcc_flags you mentioned - so the exception is totally normal.

Trying to build the "Debug|iPhone" configuration (where the options are specified) fails because of path issues... but I'm pretty sure it would work if I fixed them ;-)

UPDATE

Moving the library to it's right location gives me:

Undefined symbols for architecture armv6:   "___udivmodsi4",
referenced from:
      _sqlite3BitvecSet in libsqlciphernet.a(sqlite3.o)
      _sqlite3BitvecClear in libsqlciphernet.a(sqlite3.o)
      _sqlite3BitvecTest in libsqlciphernet.a(sqlite3.o) ld: symbol(s) not found for architecture armv6

I believe it's missing because of libopenssl ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top