Skip to content

Statically linking this extension in C code cause seg fault #6

@shah

Description

@shah

This is a great extension @asg017! I'm trying to compile and statically link this extension in my own C code.

I used your make static-release and got the .a file and then tried to compile it with this C function and it builds my binary but when I try to call udi_sqlite_init_extensions as part of the SQLite execution I get a segfault. Is there anything special I need to do on the Rust code side?

#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1

#include "sqlite-ulid/dist/release/sqlite-ulid.h"

int udi_sqlite_init_extensions(sqlite3 *db, char **pzErrMsg,
                               const sqlite3_api_routines *pApi) {
  (void)pzErrMsg;
  SQLITE_EXTENSION_INIT2(pApi);

  // Initialize all static-linked extension here (e.g., ULID)
  int rc = sqlite3_ulid_init(db, pzErrMsg, pApi);
  if (rc != SQLITE_OK) {
     return rc;
  }

  return SQLITE_OK;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions