On Tue, 25 May 2021 20:38:32 -0700 (PDT), MHH Rise wrote:
> Thank you for your reply.
> I download the package of dlls from spatialite website
> This file: mod_spatialite-5.0.1-win-x86.7z
> And used System.Data.SQLite.dll from it as reference in VS 2019 and
> loading mod_spatialite in runtime.
> where is my problem?
you are blindly mixing different copies of sqlite.dll in the same
operational framework, the first one coming from System.Data and
the second one from the mod_spatialite-win-86 binary package.
not only the two DLLs have been built using different compilers
(MSVC vs MinGW) but they probably are of different versions and
possibly different options were configured at build time.
this is a well known cause of problems and unstabilities, and
is commonly found on many complex frameworks as Java, Python,
PHP and obviously System.Data as well.
the real and effective solution should be directly compiling
mod_spatialite on behalf of your framework so to robustly
ensure that the same copy of libsqlite.dll will be referenced
in any case.
the binary distributions of mod_spatialite for Windows supported
by SpatiaLite itself are always assumed to be loaded at run
time by the same identical copy of libsqlite.dll contained
into the binary packages, that is the one targeted at build
counterproof: as yourself confirm anything runs smoothly
when using the GUI tool.
if this prerequisite is not ensured (as it frequently happens
on Java, Python etc frameworks) you should always expect some
kind of malfunction and unstability, and the KNN module is
the first candidate for being a cause of troubles.