SQLite Forum

V3.35.0 Math Functions with Pre-Compiled Binaries
Login

V3.35.0 Math Functions with Pre-Compiled Binaries

(1) By anonymous on 2021-03-12 18:09:06 [link]

So looked forward to this release, in particular the math functions but they are unavailable in the pre-compiled binaries for Windows. I'm disappointed!

I do not want to compile the source code with DSQLITE_ENABLE_MATH_FUNCTIONS enabled (one reason is that my VS2019 is failing to compile).

Any way of using the math functions with the pre-compile binaries for Windows?

(2) By Larry Brasfield (larrybr) on 2021-03-12 19:31:21 in reply to 1 [link]

Thanks for your report. This has been remedied at the [download site](https://sqlite.org/download.html) with a revised "bundle of command-line tools" for Windows.

(3) By anonymous on 2021-03-12 22:22:16 in reply to 2 [link]

Thank you. (also for the updated 64-bit DLL).

(4) By anonymous on 2021-03-12 23:01:16 in reply to 3 [link]

I can see the new math functions from within the CLI. However, the (32-bit) DLL does NOT include them: aren't they enabled?

(5.1) By Larry Brasfield (larrybr) on 2021-03-13 23:02:15 edited from 5.0 in reply to 4 [link]

The published DLLs are somewhat minimal with respect to optional features.

If you do the CLI build using the provided makefiles, and specify DYNAMIC_SHELL=1 at the make (or nmake) invocation, you will get a DLL whose features match what the shell expects and others you may set with preprocessor symbols. This will include the new-with-v3.35.0 math functions.

See <u>[How to Compile SQLite](https://sqlite.org/howtocompile.html)</u> for detailed procedures.

(6) By anonymous on 2021-03-15 21:11:02 in reply to 5.1 [link]

I managed to compile [this version](https://sqlite.org/2021/sqlite-amalgamation-3350100.zip) using Visual Studio 2019 Enterprise.

My session looks as follows:

```
SQLite version 3.35.1 2021-03-15 16:53:57
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> select cos(7) /* math function in 3.35 available? */;
Error: no such function: cos
sqlite>
```

If possible, I'd appreciate some help in specifying <b>DYNAMIC_SHELL=1</b> within Visual Studio 2019. 

<b>1. How Do I do that?</b>

Also, the 32-bit version is failing to build with this error:

```
Rebuild started...
------ Rebuild All started: Project: SQLite3, Configuration: Release Win32 ------
shell.c
sqlite3.c
Generating Code...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
MSVCRT.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)
E:\Ajay\C#\VS2019\SQLite3\Release\SQLite3.exe : fatal error LNK1120: 1 unresolved externals
Done building project "SQLite3.vcxproj" -- FAILED.
------ Rebuild All started: Project: SQLite3, Configuration: Release x64 ------
shell.c
sqlite3.c
Generating Code...
SQLite3.vcxproj -> E:\Ajay\C#\VS2019\SQLite3\x64\Release\SQLite3.exe
------ Rebuild All started: Project: SQLite3, Configuration: Debug Win32 ------
shell.c
sqlite3.c
Generating Code...
MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
E:\Ajay\C#\VS2019\SQLite3\Debug\SQLite3.exe : fatal error LNK1120: 1 unresolved externals
Done building project "SQLite3.vcxproj" -- FAILED.
------ Rebuild All started: Project: SQLite3, Configuration: Debug x64 ------
shell.c
sqlite3.c
Generating Code...
SQLite3.vcxproj -> E:\Ajay\C#\VS2019\SQLite3\x64\Debug\SQLite3.exe
========== Rebuild All: 2 succeeded, 2 failed, 0 skipped ==========
```

For the reported error, please refer to the lines [6] & [7] in the block immediately above this.

<b>2. I'd appreciate some help in overcoming this, please.</b> Or have I got the wrong end of the stick here? That is, is the SQLite CLI executable ALWAYS 64 bit?

(7) By anonymous on 2021-03-15 21:51:09 in reply to 6 [link]

I note that [this link](https://sqlite.org/2021/sqlite-dll-win32-x86-3350100.zip) now provides the 32-bit DLL version 3.35.1 with the math functions enabled. 

<b>Many thanks for this.</b>

(8) By Larry Brasfield (larrybr) on 2021-03-15 21:53:01 in reply to 6 [link]

Please take this next in the kindly spirit it is offered:

The reason I referred you to <u>[How to Compile SQLite](https://sqlite.org/howtocompile.html)</u> instead of suggesting that you fire up Visual Studio is because I know, from having done what is needed to make that way work, that following the guidance at the link is **much simpler**.

With that said, I will just comment on some of the problems you are seeing. Maybe that will suffice for you to get the VS build going.

Re "ignoring '/INCREMENTAL'": You should also ignore that. Better yet, turn off incremental linking. It saves very little time.

Re "unresolved external symbol _WinMain@16": Do not let the magical, make-a-project VS feature do anything for you. You have made what is known as a Windows GUI project, whose entry point (as far as user-written code is concerned) is WinMain().  The shell's entry point is main(), as is nearly always the case for console projects.

The Makefile.msc that comes with the amalgamation is perfectly capable of building 32-bit or 64-bit versions of the SQLite library and its CLI shell. You want to use the various "... Command Prompt ..." shortcuts installed in the Start menu alongside the shortcut for that nice VS IDE, provided that you are following the linked guidance. (And good luck otherwise. I have gone that route because I wanted to debug SQLite itself and use its very nice code navigation aids. But it will take more work on your part.)

(9) By anonymous on 2021-03-15 22:52:14 in reply to 8

Thanks for the hints Larry.

My problem is that when it comes to C/C++, my handicap is that I know next to nothing about it and even less about how Visual Studio 2019 deals with projects & configuration in that language. So long as precompiled binaries provide the functionality I seek, I am (naively) happy to defer the learning curve indefinitely, not least because the precompiled binaries provide a uniform/standard reference context especially when raising issues in this forum.

I tried to enumerate the new functions in 3.35.1; in the table below, a * in the final column named <i>Newin3_35</i> in the table below indicates the new functions. 

[This document](https://www.sqlite.org/draft/lang_mathfunc.html) makes no mention of the geopoly* functions which (all but one) appear to be new. <i>Have I missed something, here?</i>

name                     ||builtin||type||enc ||narg||flags  ||Newin3_35
-------------------------||-------||----||----||----||-------||---------
abs                      ||1      ||s   ||utf8||1   ||2099200||
acos                     ||1      ||s   ||utf8||1   ||2099200||*
acosh                    ||1      ||s   ||utf8||1   ||2099200||*
asin                     ||1      ||s   ||utf8||1   ||2099200||*
asinh                    ||1      ||s   ||utf8||1   ||2099200||*
atan                     ||1      ||s   ||utf8||1   ||2099200||*
atan2                    ||1      ||s   ||utf8||2   ||2099200||*
atanh                    ||1      ||s   ||utf8||1   ||2099200||*
avg                      ||1      ||w   ||utf8||1   ||2097152||
bm25                     ||0      ||s   ||utf8||-1  ||0      ||
ceil                     ||1      ||s   ||utf8||1   ||2099200||*
ceiling                  ||1      ||s   ||utf8||1   ||2099200||*
changes                  ||1      ||s   ||utf8||0   ||2097152||
char                     ||1      ||s   ||utf8||-1  ||2099200||
coalesce                 ||1      ||s   ||utf8||-1  ||2099200||
cos                      ||1      ||s   ||utf8||1   ||2099200||*
cosh                     ||1      ||s   ||utf8||1   ||2099200||*
count                    ||1      ||w   ||utf8||0   ||2097152||
count                    ||1      ||w   ||utf8||1   ||2097152||
cume_dist                ||1      ||w   ||utf8||0   ||2097152||
current_date             ||1      ||s   ||utf8||0   ||2097152||
current_time             ||1      ||s   ||utf8||0   ||2097152||
current_timestamp        ||1      ||s   ||utf8||0   ||2097152||
date                     ||1      ||s   ||utf8||-1  ||2099200||
datetime                 ||1      ||s   ||utf8||-1  ||2099200||
decimal                  ||0      ||s   ||utf8||1   ||2099200||
decimal_add              ||0      ||s   ||utf8||2   ||2099200||
decimal_cmp              ||0      ||s   ||utf8||2   ||2099200||
decimal_mul              ||0      ||s   ||utf8||2   ||2099200||
decimal_sub              ||0      ||s   ||utf8||2   ||2099200||
decimal_sum              ||0      ||w   ||utf8||1   ||2099200||
degrees                  ||1      ||s   ||utf8||1   ||2099200||*
dense_rank               ||1      ||w   ||utf8||0   ||2097152||
edit                     ||0      ||s   ||utf8||1   ||0      ||
edit                     ||0      ||s   ||utf8||2   ||0      ||
exp                      ||1      ||s   ||utf8||1   ||2099200||*
first_value              ||1      ||w   ||utf8||1   ||2097152||
floor                    ||1      ||s   ||utf8||1   ||2099200||*
fts3_tokenizer           ||0      ||s   ||utf8||1   ||524288 ||
fts3_tokenizer           ||0      ||s   ||utf8||2   ||524288 ||
fts5                     ||0      ||s   ||utf8||1   ||0      ||
fts5_decode              ||0      ||s   ||utf8||2   ||0      ||
fts5_decode_none         ||0      ||s   ||utf8||2   ||0      ||
fts5_expr                ||0      ||s   ||utf8||-1  ||0      ||
fts5_expr_tcl            ||0      ||s   ||utf8||-1  ||0      ||
fts5_fold                ||0      ||s   ||utf8||-1  ||0      ||
fts5_isalnum             ||0      ||s   ||utf8||-1  ||0      ||
fts5_rowid               ||0      ||s   ||utf8||-1  ||0      ||
fts5_source_id           ||0      ||s   ||utf8||0   ||0      ||
geopoly_area             ||0      ||s   ||utf8||1   ||2099200||*
geopoly_bbox             ||0      ||s   ||utf8||1   ||2099200||*
geopoly_blob             ||0      ||s   ||utf8||1   ||2099200||*
geopoly_ccw              ||0      ||s   ||utf8||1   ||2099200||*
geopoly_contains_point   ||0      ||s   ||utf8||3   ||2099200||*
geopoly_debug            ||0      ||s   ||utf8||1   ||524288 ||*
geopoly_group_bbox       ||0      ||a   ||utf8||1   ||2099200||*
geopoly_json             ||0      ||s   ||utf8||1   ||2099200||*
geopoly_overlap          ||0      ||s   ||utf8||2   ||2099200||*
geopoly_regular          ||0      ||s   ||utf8||4   ||2099200||*
geopoly_svg              ||0      ||s   ||utf8||-1  ||2099200||*
geopoly_within           ||0      ||s   ||utf8||2   ||2099200||*
geopoly_xform            ||0      ||s   ||utf8||7   ||2099200||*
glob                     ||1      ||s   ||utf8||2   ||2099200||
group_concat             ||1      ||w   ||utf8||1   ||2097152||
group_concat             ||1      ||w   ||utf8||2   ||2097152||
hex                      ||1      ||s   ||utf8||1   ||2099200||
highlight                ||0      ||s   ||utf8||-1  ||0      ||
ieee754                  ||0      ||s   ||utf8||1   ||2097152||
ieee754                  ||0      ||s   ||utf8||2   ||2097152||
ieee754_exponent         ||0      ||s   ||utf8||1   ||2097152||
ieee754_from_blob        ||0      ||s   ||utf8||1   ||2097152||
ieee754_mantissa         ||0      ||s   ||utf8||1   ||2097152||
ieee754_to_blob          ||0      ||s   ||utf8||1   ||2097152||
ifnull                   ||1      ||s   ||utf8||2   ||2099200||
iif                      ||1      ||s   ||utf8||3   ||2099200||
instr                    ||1      ||s   ||utf8||2   ||2099200||
json                     ||0      ||s   ||utf8||1   ||2099200||
json_array               ||0      ||s   ||utf8||-1  ||2099200||
json_array_length        ||0      ||s   ||utf8||1   ||2099200||
json_array_length        ||0      ||s   ||utf8||2   ||2099200||
json_extract             ||0      ||s   ||utf8||-1  ||2099200||
json_group_array         ||0      ||w   ||utf8||1   ||3147776||
json_group_object        ||0      ||w   ||utf8||2   ||3147776||
json_insert              ||0      ||s   ||utf8||-1  ||2099200||
json_object              ||0      ||s   ||utf8||-1  ||2099200||
json_patch               ||0      ||s   ||utf8||2   ||2099200||
json_quote               ||0      ||s   ||utf8||1   ||2099200||
json_remove              ||0      ||s   ||utf8||-1  ||2099200||
json_replace             ||0      ||s   ||utf8||-1  ||2099200||
json_set                 ||0      ||s   ||utf8||-1  ||2099200||
json_type                ||0      ||s   ||utf8||1   ||2099200||
json_type                ||0      ||s   ||utf8||2   ||2099200||
json_valid               ||0      ||s   ||utf8||1   ||2099200||
julianday                ||1      ||s   ||utf8||-1  ||2099200||
lag                      ||1      ||w   ||utf8||1   ||2097152||
lag                      ||1      ||w   ||utf8||2   ||2097152||
lag                      ||1      ||w   ||utf8||3   ||2097152||
last_insert_rowid        ||1      ||s   ||utf8||0   ||2097152||
last_value               ||1      ||w   ||utf8||1   ||2097152||
lead                     ||1      ||w   ||utf8||1   ||2097152||
lead                     ||1      ||w   ||utf8||2   ||2097152||
lead                     ||1      ||w   ||utf8||3   ||2097152||
length                   ||1      ||s   ||utf8||1   ||2099200||
like                     ||1      ||s   ||utf8||2   ||2099200||
like                     ||1      ||s   ||utf8||3   ||2099200||
likelihood               ||1      ||s   ||utf8||2   ||2099200||
likely                   ||1      ||s   ||utf8||1   ||2099200||
ln                       ||1      ||s   ||utf8||1   ||2099200||*
load_extension           ||1      ||s   ||utf8||1   ||524288 ||
load_extension           ||1      ||s   ||utf8||2   ||524288 ||
log                      ||1      ||s   ||utf8||1   ||2099200||*
log                      ||1      ||s   ||utf8||2   ||2099200||*
log10                    ||1      ||s   ||utf8||1   ||2099200||*
log2                     ||1      ||s   ||utf8||1   ||2099200||*
lower                    ||1      ||s   ||utf8||1   ||2099200||
lsmode                   ||0      ||s   ||utf8||1   ||0      ||
ltrim                    ||1      ||s   ||utf8||1   ||2099200||
ltrim                    ||1      ||s   ||utf8||2   ||2099200||
match                    ||0      ||s   ||utf8||2   ||0      ||
matchinfo                ||0      ||s   ||utf8||1   ||0      ||
matchinfo                ||0      ||s   ||utf8||2   ||0      ||
max                      ||1      ||s   ||utf8||-1  ||2099200||
max                      ||1      ||w   ||utf8||1   ||2097152||
min                      ||1      ||s   ||utf8||-1  ||2099200||
min                      ||1      ||w   ||utf8||1   ||2097152||
mod                      ||1      ||s   ||utf8||2   ||2099200||*
nth_value                ||1      ||w   ||utf8||2   ||2097152||
ntile                    ||1      ||w   ||utf8||1   ||2097152||
nullif                   ||1      ||s   ||utf8||2   ||2099200||
offsets                  ||0      ||s   ||utf8||1   ||0      ||
optimize                 ||0      ||s   ||utf8||1   ||0      ||
percent_rank             ||1      ||w   ||utf8||0   ||2097152||
pi                       ||1      ||s   ||utf8||0   ||2099200||*
pow                      ||1      ||s   ||utf8||2   ||2099200||*
power                    ||1      ||s   ||utf8||2   ||2099200||*
printf                   ||1      ||s   ||utf8||-1  ||2099200||
quote                    ||1      ||s   ||utf8||1   ||2099200||
radians                  ||1      ||s   ||utf8||1   ||2099200||*
random                   ||1      ||s   ||utf8||0   ||2097152||
randomblob               ||1      ||s   ||utf8||1   ||2097152||
rank                     ||1      ||w   ||utf8||0   ||2097152||
readfile                 ||0      ||s   ||utf8||1   ||524288 ||
replace                  ||1      ||s   ||utf8||3   ||2099200||
round                    ||1      ||s   ||utf8||1   ||2099200||
round                    ||1      ||s   ||utf8||2   ||2099200||
row_number               ||1      ||w   ||utf8||0   ||2097152||
rtreecheck               ||0      ||s   ||utf8||-1  ||0      ||
rtreedepth               ||0      ||s   ||utf8||1   ||0      ||
rtreenode                ||0      ||s   ||utf8||2   ||0      ||
rtrim                    ||1      ||s   ||utf8||1   ||2099200||
rtrim                    ||1      ||s   ||utf8||2   ||2099200||
sha3                     ||0      ||s   ||utf8||1   ||2099200||
sha3                     ||0      ||s   ||utf8||2   ||2099200||
sha3_query               ||0      ||s   ||utf8||1   ||524288 ||
sha3_query               ||0      ||s   ||utf8||2   ||524288 ||
shell_add_schema         ||0      ||s   ||utf8||3   ||0      ||
shell_escape_crnl        ||0      ||s   ||utf8||1   ||0      ||
shell_idquote            ||0      ||s   ||utf8||1   ||0      ||
shell_int32              ||0      ||s   ||utf8||2   ||0      ||
shell_module_schema      ||0      ||s   ||utf8||1   ||0      ||
shell_putsnl             ||0      ||s   ||utf8||1   ||0      ||
sign                     ||1      ||s   ||utf8||1   ||2099200||*
sin                      ||1      ||s   ||utf8||1   ||2099200||*
sinh                     ||1      ||s   ||utf8||1   ||2099200||*
snippet                  ||0      ||s   ||utf8||-1  ||0      ||
sqlar_compress           ||0      ||s   ||utf8||1   ||2097152||
sqlar_uncompress         ||0      ||s   ||utf8||2   ||2097152||
sqlite_compileoption_get ||1      ||s   ||utf8||1   ||2097152||
sqlite_compileoption_used||1      ||s   ||utf8||1   ||2097152||
sqlite_log               ||1      ||s   ||utf8||2   ||2099200||
sqlite_offset            ||1      ||s   ||utf8||1   ||2099200||*
sqlite_source_id         ||1      ||s   ||utf8||0   ||2097152||
sqlite_version           ||1      ||s   ||utf8||0   ||2097152||
sqrt                     ||1      ||s   ||utf8||1   ||2099200||*
strftime                 ||1      ||s   ||utf8||-1  ||2099200||
substr                   ||1      ||s   ||utf8||2   ||2099200||
substr                   ||1      ||s   ||utf8||3   ||2099200||
substring                ||1      ||s   ||utf8||2   ||2099200||
substring                ||1      ||s   ||utf8||3   ||2099200||
sum                      ||1      ||w   ||utf8||1   ||2097152||
tan                      ||1      ||s   ||utf8||1   ||2099200||*
tanh                     ||1      ||s   ||utf8||1   ||2099200||*
time                     ||1      ||s   ||utf8||-1  ||2099200||
total                    ||1      ||w   ||utf8||1   ||2097152||
total_changes            ||1      ||s   ||utf8||0   ||2097152||
trim                     ||1      ||s   ||utf8||1   ||2099200||
trim                     ||1      ||s   ||utf8||2   ||2099200||
trunc                    ||1      ||s   ||utf8||1   ||2099200||*
typeof                   ||1      ||s   ||utf8||1   ||2099200||
unicode                  ||1      ||s   ||utf8||1   ||2099200||
unknown                  ||1      ||s   ||utf8||-1  ||2099200||
unlikely                 ||1      ||s   ||utf8||1   ||2099200||
upper                    ||1      ||s   ||utf8||1   ||2099200||
usleep                   ||0      ||s   ||utf8||1   ||0      ||
writefile                ||0      ||s   ||utf8||-1  ||524288 ||
zeroblob                 ||1      ||s   ||utf8||1   ||2099200||
zipfile                  ||0      ||a   ||utf8||-1  ||0      ||
zipfile_cds              ||0      ||s   ||utf8||-1  ||0      ||

(10) By Larry Brasfield (larrybr) on 2021-03-16 02:17:48 in reply to 9 [link]

I just have a minute here.

You will not find the geopoly extension functions in the page on math functions because the geopoly functions are not normally considered to be math functions.

I don't think they are new either. At least less new than the math functions.