Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrypoint ignored when loading an extension #860

Closed
terrakuh opened this issue Oct 1, 2020 · 0 comments
Closed

Entrypoint ignored when loading an extension #860

terrakuh opened this issue Oct 1, 2020 · 0 comments

Comments

@terrakuh
Copy link
Contributor

terrakuh commented Oct 1, 2020

When loading an extension with a custom entrypoint the default entrypoint is called.

sql.Register("sqlite3-crypt", &sqlite3.SQLiteDriver{
	ConnectHook: func(conn *sqlite3.SQLiteConn) error {
		// always calls the default entrypoint and not init_db
		return conn.LoadExtension("/path/to/ysqlite3_crypt_vfs.ext", "init_db")
	},
})

The extension:

#ifdef _WIN32
__declspec(dllexport)
#endif
    extern "C" int init_db(sqlite3* db, char** error_message, const sqlite3_api_routines* api) noexcept
{
	/* I want to call this entrypoint */
}

#ifdef _WIN32
__declspec(dllexport)
#endif
    extern "C" int sqlite3_ysqlitecryptvfs_init(sqlite3* db, char** error_message,
                                                const sqlite3_api_routines* api) noexcept
{
	/* But this entrypoint is always called */
}
@mattn mattn closed this as completed in 92f580b Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant