Skip to content

Commit

Permalink
support dynamic loading of sqlite3 sha3 extension (#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
larskuhtz authored Dec 14, 2023
1 parent 5f1b41c commit c1c9875
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion c/shathree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
** is used. If SIZE is included it must be one of the integers 224, 256,
** 384, or 512, to determine SHA3 hash variant that is computed.
*/
#include "sqlite3.h"
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1

#include <assert.h>
#include <string.h>
#include <stdarg.h>
Expand Down Expand Up @@ -635,3 +637,19 @@ int sqlite3_shathree_create_functions(sqlite3 *db)
return rc;
}

/* ************************************************************************** */
/* SQLite Extension
*
* When compiled as shared library this supports dynamic loading of the
* extension.
*/
int sqlite3_shathree_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
sqlite3_shathree_create_functions(db);
return rc;
}
1 change: 1 addition & 0 deletions chainweb.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ library
autogen-modules:
Paths_chainweb
c-sources: c/shathree.c
cc-options: -DSQLITE_CORE
exposed-modules:
Chainweb.Backup
, Chainweb.BlockCreationTime
Expand Down

0 comments on commit c1c9875

Please sign in to comment.