Skip to content

Commit

Permalink
use sqlite3_html_init as entrypoint, fix windows issues
Browse files Browse the repository at this point in the history
  • Loading branch information
asg017 committed Mar 28, 2023
1 parent 09a41b6 commit aeff7ee
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -46,10 +46,10 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -81,10 +81,10 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
name: sqlite-html-linux_x86
path: dist/html0.so

build-linux_x86-python:
runs-on: ubuntu-20.04
needs: [build-linux_x86-extension]
Expand Down Expand Up @@ -80,10 +79,10 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -154,10 +153,10 @@ jobs:
- uses: actions/checkout@v2
# using actions/setup-go@v1 is the only way to get macos build to work.
# otherwise, with v2, would get this cgo error: 'cgo-generated-wrappers:13:13: error: redefinition of 'free' as different kind of symbol'
- name: Set up Go 1.17
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.17
go-version: 1.20
- run: make loadable
- uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion deno/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function getLoadablePath(): string {
/**
* Entrypoint name for the sqlite-html extension.
*/
export const entrypoint = "sqlite3_extension_init";
export const entrypoint = "sqlite3_html_init";

interface Db {
// after https://deno.land/x/[email protected]/mod.ts?s=Database#method_loadExtension_0
Expand Down
3 changes: 3 additions & 0 deletions shared.no → shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ SQLITE_EXTENSION_INIT3

extern int go_sqlite3_extension_init(const char*, sqlite3*, char**);

#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_html_init(sqlite3* db, char** pzErrMsg, const sqlite3_api_routines *pApi) {
SQLITE_EXTENSION_INIT2(pApi)
return go_sqlite3_extension_init("html", db, pzErrMsg);
Expand Down
14 changes: 7 additions & 7 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"go.riyazali.net/sqlite"
)

/// // following linker flags are needed to suppress missing symbol warning in intermediate stages
///
/// // #cgo linux LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
/// // #cgo darwin LDFLAGS: -Wl,-undefined,dynamic_lookup
/// // #cgo windows LDFLAGS: -lsqlite3
/// import "C"
// following linker flags are needed to suppress missing symbol warning in intermediate stages

// #cgo linux LDFLAGS: -Wl,--unresolved-symbols=ignore-in-object-files
// #cgo darwin LDFLAGS: -Wl,-undefined,dynamic_lookup
// #cgo windows LDFLAGS: -Wl,--allow-multiple-definition
import "C"

// Set in Makefile
var (
Expand Down Expand Up @@ -40,7 +40,7 @@ func Register(api *sqlite.ExtensionApi) (sqlite.ErrorCode, error) {
}

func init() {
//sqlite.RegisterNamed("html", Register)
sqlite.RegisterNamed("html", Register)
sqlite.Register(Register)
}

Expand Down

0 comments on commit aeff7ee

Please sign in to comment.