Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 671193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:20:47+00:00 2026-05-14T00:20:47+00:00

I use a statically linked library for Sqlite in an iPhone Xcode project. I

  • 0

I use a statically linked library for Sqlite in an iPhone Xcode project. I am now trying to include a .C extension to Sqlite in this project. However, I am having trouble making the Sqlite in the build SEE the extension.

The statically linked Sqlite library works fine. Also the .C extension works on my desktop, and builds fine as a statically linked library in Xcode. However, the custom functions it defines are missing when called.

For example, I load the extension as so with no errors.

SELECT load_extension('extension_name.so');

But when I try to call a function defined in the extension, I get this message

DB Error: 1 "no such function: custom_function"

Does anyone know much about linking a Sqlite extension into an Xcode project?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:20:47+00:00Added an answer on May 14, 2026 at 12:20 am

    As said by @jbworld you cannot load dynamic libraries on the iPhone, so this link should be made statically, at compilation time. While reading at the code of spatialite (that’s an SQLite extension), I found that kind of invocation:

    void spatialite_init (int verbose) {
    /* used when SQLite initializes SpatiaLite via statically linked lib */
        sqlite3_auto_extension ((void (*)(void)) init_static_spatialite);
    }
    

    And the init_static_spatialite code:

    static void init_static_spatialite (sqlite3 * db, char **pzErrMsg,
                const sqlite3_api_routines * pApi)
    {
        SQLITE_EXTENSION_INIT2 (pApi);
    /* setting the POSIX locale for numeric */
        setlocale (LC_NUMERIC, "POSIX");
        *pzErrMsg = NULL;
        sqlite3_create_function (db, "spatialite_version", 0, SQLITE_ANY, 0,
                                 fnct_spatialite_version, 0, 0);
        sqlite3_create_function (db, "proj4_version", 0, SQLITE_ANY, 0,
                                 fnct_proj4_version, 0, 0);
        sqlite3_create_function (db, "geos_version", 0, SQLITE_ANY, 0,
                                 fnct_geos_version, 0, 0);
        sqlite3_create_function (db, "GeometryConstraints", 3, SQLITE_ANY, 0,
                                 fnct_GeometryConstraints, 0, 0);
        sqlite3_create_function (db, "CheckSpatialMetaData", 0, SQLITE_ANY, 0,
                                 fnct_CheckSpatialMetaData, 0, 0);
    ...
    

    So it looks like if the sqlite_auto_extension enables you to statically link an extension. The documentation seems to confirm that:

    “This API can be invoked at program startup in order to register one or more statically linked extensions that will be available to all new database connections.”

    Then, at runtime, for spatialite, I just have to invoke the spatialite_init(0) to get the extension up and running.

    Invoke such method before loading any sqlite DB.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We use Boost statically linked with our app but now I want to use
For a rather obscure use case I'd like to have a (large) statically linked
I have a library compiled into a .a file, linked against my application. (iphone,
I'm trying to build CGAL for windows to use in my project under Visual
I'm trying to statically link to libcrypto.a (from the openssl library) after building it
I'm attempting to use the ZeroMQ library in an iPhone app developed in C#
I'm trying to use SVG graphics in QIcons. I have a static library that
I have a problem with statically linked openSSL library and GOST crypto engine. I
I have created a communication library which is linked statically into several different applications.
I'm trying to use FFmpeg in a C++ project in Visual Studio 2010. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.