Spatialite 4.x Extension not Loadable on Windows 10

90 views
Skip to first unread message

ro...@tackettproxy.com

unread,
Mar 14, 2016, 9:13:40 PM3/14/16
to SpatiaLite Users
The following "app" works on my various Windows 7 machines but does not on similarly configured Windows 10 machines. I've checked every permutation and combination of settings, conflicts in the path. The project works on Win7 in either AnyCPU or x64 modes. It does not work in either mode on Win10. The project works on the Win7 boxes using v4 or v4.5 but neither on Win10. I've run dependency walker and there are false positives on both platforms.

1. Can anyone please help?
2. Is there any way I can force mod_spatialite.dll to report what dll is the culprit (understanding that it may be a downstream DLL that is missing, which mod_spatialite may not visibility into)?

TIA, Chris

// NOTE: Configuration is AnyCPU
//       .NET v4 Framework
//       Both Machines have 32 and 64 bit versions of all MSVC (2010,12,13,15)
//       System.Data.SQLite v1.0.99


using System;
using System.Data.SQLite;

namespace SandboxSpatialite
{
   
class Program
   
{
       
static void Main(string[] args)
       
{
           
var modSpatialiteFolderPath = @"c:\tools\Spatialite\lib\mod_spatialite-4.3.0a-win-amd64";


           
string path = modSpatialiteFolderPath + ";" + Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
           
Environment.SetEnvironmentVariable("Path", path, EnvironmentVariableTarget.Process);


           
using (var cn = new SQLiteConnection(@"Data Source=c:\temp\sample.sqlite"))
           
{
                cn
.Open();
               
using (var cm = cn.CreateCommand())
               
{
                    cn
.EnableExtensions(true);
                   
string mod_spatialite_dllPath = @"mod_spatialite";
                    cn
.LoadExtension(mod_spatialite_dllPath);
                    cm
.CommandText = string.Format("Select spatialite_version();");
                   
var sc = cm.ExecuteScalar();
                   
Console.WriteLine(sc.ToString());
               
}
           
}
       
}        
   
}
}


Reply all
Reply to author
Forward
0 new messages