Re: [sqlite] Access to sqlite3_api_routines outside of a loadable extension context

2018-04-06 Thread petern
Max. You are free to export your code differently by preprocessor
directives.  One binary of your code can be an extension and another can be
an ordinary library.  The loadable version binary simply needs to export a
working sqlite3_extension_init() C entrypoint as described here:

https://www.sqlite.org/loadext.html#programming_loadable_extensions

Here is another reply about reusing code between a SQLite server and client
that should give you some ideas:

http://sqlite.1065341.n5.nabble.com/Function-design-question-tc100925.html#a100933

Peter



On Thu, Apr 5, 2018 at 8:23 AM, Max Vlasov  wrote:

> Hi,
> I'm considering creating a virtual table or user function that might
> possible work either as a loadable extension or as a general, statically
> created one. In order to avoid repeating during developing, I thought that
> I might use sqlite3_api_routines structure as a universal access to sqlite
> code routines in both cases. But it seems it is impossible to access the
> structure outside of a loadable extension context. Or am I missing
> something?
>
> Probably some direct access to sqlite3Apis variable is possible, but I
> suspect such practice isn't  recommended.
>
> Thanks
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Access to sqlite3_api_routines outside of a loadable extension context

2018-04-06 Thread Max Vlasov
Oh, I see, just looked at the examples, all you described works thanks to
the magic of c preprocessor. The problem in my case is that I'm on Delphi.
Plus I already has something like indirect access to sqlite api functions,
I will probably make a converter during the init between sqlite3Apis and my
structure

Thanks

On Fri, Apr 6, 2018 at 12:52 AM, Keith Medcalf <kmedc...@dessus.com> wrote:

>
> You write the code as if it were a loadable extension.
>
> If you compile "inline" (ie, appended to the amalgamation) the headers
> will detect the SQLITE_CORE symbol being defined and generate direct calls
> rather than indirect calls.  There is really no need to change the code
> from the code you would use from a loadable extension, unless you want to
> "hide" the loadable extension init() symbol when compiled as part of the
> amalgamation (or inline using the SQLITE_CORE define) and use the
> EXTRA_INIT hook to do initialization.
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says
> a lot about anticipated traffic volume.
>
> >-Original Message-
> >From: sqlite-users [mailto:sqlite-users-
> >boun...@mailinglists.sqlite.org] On Behalf Of Max Vlasov
> >Sent: Thursday, 5 April, 2018 09:24
> >To: SQLite mailing list
> >Subject: [sqlite] Access to sqlite3_api_routines outside of a
> >loadable extension context
> >
> >Hi,
> >I'm considering creating a virtual table or user function that might
> >possible work either as a loadable extension or as a general,
> >statically
> >created one. In order to avoid repeating during developing, I thought
> >that
> >I might use sqlite3_api_routines structure as a universal access to
> >sqlite
> >code routines in both cases. But it seems it is impossible to access
> >the
> >structure outside of a loadable extension context. Or am I missing
> >something?
> >
> >Probably some direct access to sqlite3Apis variable is possible, but
> >I
> >suspect such practice isn't  recommended.
> >
> >Thanks
> >___
> >sqlite-users mailing list
> >sqlite-users@mailinglists.sqlite.org
> >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Access to sqlite3_api_routines outside of a loadable extension context

2018-04-05 Thread Keith Medcalf

You write the code as if it were a loadable extension.  

If you compile "inline" (ie, appended to the amalgamation) the headers will 
detect the SQLITE_CORE symbol being defined and generate direct calls rather 
than indirect calls.  There is really no need to change the code from the code 
you would use from a loadable extension, unless you want to "hide" the loadable 
extension init() symbol when compiled as part of the amalgamation (or inline 
using the SQLITE_CORE define) and use the EXTRA_INIT hook to do initialization.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.

>-Original Message-
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Max Vlasov
>Sent: Thursday, 5 April, 2018 09:24
>To: SQLite mailing list
>Subject: [sqlite] Access to sqlite3_api_routines outside of a
>loadable extension context
>
>Hi,
>I'm considering creating a virtual table or user function that might
>possible work either as a loadable extension or as a general,
>statically
>created one. In order to avoid repeating during developing, I thought
>that
>I might use sqlite3_api_routines structure as a universal access to
>sqlite
>code routines in both cases. But it seems it is impossible to access
>the
>structure outside of a loadable extension context. Or am I missing
>something?
>
>Probably some direct access to sqlite3Apis variable is possible, but
>I
>suspect such practice isn't  recommended.
>
>Thanks
>___
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Access to sqlite3_api_routines outside of a loadable extension context

2018-04-05 Thread Max Vlasov
Hi,
I'm considering creating a virtual table or user function that might
possible work either as a loadable extension or as a general, statically
created one. In order to avoid repeating during developing, I thought that
I might use sqlite3_api_routines structure as a universal access to sqlite
code routines in both cases. But it seems it is impossible to access the
structure outside of a loadable extension context. Or am I missing
something?

Probably some direct access to sqlite3Apis variable is possible, but I
suspect such practice isn't  recommended.

Thanks
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users