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

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Another reason you'd get 0 affected rows is if the… May 14, 2026 at 6:53 pm
  • Editorial Team
    Editorial Team added an answer That's a pretty common solution. Boost does it, and I… May 14, 2026 at 6:53 pm
  • Editorial Team
    Editorial Team added an answer You can't overload the sizeof operator. And I'm not sure… May 14, 2026 at 6:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.