Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add experimental support for pre-loading the native SQLite library based on the processor architecture of the current process. For now, this feature is disabled by default. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d3df632e9f97cf6d37fbc9e4750ae4bf |
User & Date: | mistachkin 2012-02-22 03:54:24.563 |
Context
2012-02-22
| ||
04:13 | Skip compiling in the native library pre-loading code if the mixed-mode assembly is being built. check-in: 6eb5fdb936 user: mistachkin tags: trunk | |
03:54 | Add experimental support for pre-loading the native SQLite library based on the processor architecture of the current process. For now, this feature is disabled by default. check-in: d3df632e9f user: mistachkin tags: trunk | |
2012-02-21
| ||
05:55 | First draft of design-time component installer tests for Visual Studio 2005. check-in: f61c34b3a0 user: mistachkin tags: trunk | |
Changes
Changes to SQLite.Interop/SQLite.Interop.2008.vcproj.
︙ | ︙ | |||
303 304 305 306 307 308 309 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="DebugNativeOnly|x64" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" |
︙ | ︙ | |||
394 395 396 397 398 399 400 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "AMD64" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" |
︙ | ︙ | |||
683 684 685 686 687 688 689 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="ReleaseNativeOnly|x64" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" |
︙ | ︙ | |||
776 777 778 779 780 781 782 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "AMD64" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\" /D /E /V /I /F /H /Y" /> </Configuration> </Configurations> <References> </References> <Files> <Filter |
︙ | ︙ |
Changes to SQLite.Interop/SQLite.Interop.2010.vcxproj.
︙ | ︙ | |||
231 232 233 234 235 236 237 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | > | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'"> <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> |
︙ | ︙ | |||
265 266 267 268 269 270 271 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | > | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
︙ | ︙ | |||
388 389 390 391 392 393 394 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | | > | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'"> <ClCompile> <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
︙ | ︙ | |||
425 426 427 428 429 430 431 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | | > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="src\win\AssemblyInfo.cpp"> <ExcludedFromBuild>true</ExcludedFromBuild> </ClCompile> <ClCompile Include="src\win\crypt.c"> |
︙ | ︙ |
Changes to SQLite.Interop/SQLite.Interop.2010.vcxproj.filters.
︙ | ︙ |
Changes to SQLite.Interop/SQLite.Interop.Static.2008.vcproj.
︙ | ︙ | |||
303 304 305 306 307 308 309 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="DebugNativeOnly|x64" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" ConfigurationType="2" |
︙ | ︙ | |||
394 395 396 397 398 399 400 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "AMD64" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Debug\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" ConfigurationType="2" |
︙ | ︙ | |||
683 684 685 686 687 688 689 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\" /D /E /V /I /F /H /Y" /> </Configuration> <Configuration Name="ReleaseNativeOnly|x64" OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static" ConfigurationType="2" |
︙ | ︙ | |||
776 777 778 779 780 781 782 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" | | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | Name="VCFxCopTool" /> <Tool Name="VCAppVerifierTool" /> <Tool Name="VCPostBuildEventTool" CommandLine="XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\$(PlatformName)\" /D /E /V /I /F /H /Y && IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" IF /I "%PROCESSOR_ARCHITEW6432%" == "AMD64" XCOPY "$(TargetPath)" "$(OutDir)..\..\..\Release\bin\" /D /E /V /I /F /H /Y" /> </Configuration> </Configurations> <References> </References> <Files> <Filter |
︙ | ︙ |
Changes to SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.
︙ | ︙ | |||
231 232 233 234 235 236 237 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | > | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'"> <ClCompile> <Optimization>Disabled</Optimization> <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> |
︙ | ︙ | |||
265 266 267 268 269 270 271 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | > | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Debug\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
︙ | ︙ | |||
388 389 390 391 392 393 394 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | | > | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'"> <ClCompile> <Optimization>Full</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
︙ | ︙ | |||
425 426 427 428 429 430 431 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> | | > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | </Link> <Manifest> <VerboseOutput>true</VerboseOutput> <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity> <UpdateFileHashes>true</UpdateFileHashes> </Manifest> <PostBuildEvent> <Command>XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\$(Platform)\" /D /E /V /I /F /H /Y XCOPY "$(TargetPath)" "$(OutDir)..\..\Release\bin\" /D /E /V /I /F /H /Y</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="src\win\AssemblyInfo.cpp"> <ExcludedFromBuild>true</ExcludedFromBuild> </ClCompile> <ClCompile Include="src\win\crypt.c"> |
︙ | ︙ |
Changes to SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.filters.
︙ | ︙ |
Changes to SQLite.NET.Settings.targets.
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | <!-- NOTE: Throw an exception if an object has already been disposed? By default, this is enabled. If this is disabled, an exception will not be thrown when a SQLite object which has already been disposed is accessed. --> <ThrowOnDisposed Condition="'$(ThrowOnDisposed)' == ''">true</ThrowOnDisposed> </PropertyGroup> <!-- ****************************************************************************** ** Warning Properties ** ****************************************************************************** --> | > > > > > > > > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | <!-- NOTE: Throw an exception if an object has already been disposed? By default, this is enabled. If this is disabled, an exception will not be thrown when a SQLite object which has already been disposed is accessed. --> <ThrowOnDisposed Condition="'$(ThrowOnDisposed)' == ''">true</ThrowOnDisposed> <!-- NOTE: *EXPERIMENTAL* Attempt to pre-load the native SQLite library? By default, this is disabled. If this is enabled, an attempt will be made to pre-load the native SQLite library appropriate to the processor architecture of the currently running process upon using the component. This feature is experimental and may be modified or removed in a future release. --> <PreLoadNativeLibrary Condition="'$(PreLoadNativeLibrary)' == ''">false</PreLoadNativeLibrary> </PropertyGroup> <!-- ****************************************************************************** ** Warning Properties ** ****************************************************************************** --> |
︙ | ︙ |
Changes to System.Data.SQLite/System.Data.SQLite.Properties.targets.
︙ | ︙ | |||
53 54 55 56 57 58 59 60 | <!-- NOTE: Throw an exception when somebody tries to access a disposed object? --> <PropertyGroup Condition="'$(ThrowOnDisposed)' != 'false'"> <DefineConstants>$(DefineConstants);THROW_ON_DISPOSED</DefineConstants> </PropertyGroup> </Project> | > > > > > > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | <!-- NOTE: Throw an exception when somebody tries to access a disposed object? --> <PropertyGroup Condition="'$(ThrowOnDisposed)' != 'false'"> <DefineConstants>$(DefineConstants);THROW_ON_DISPOSED</DefineConstants> </PropertyGroup> <!-- NOTE: Attempt to pre-load the native SQLite library? --> <PropertyGroup Condition="'$(PreLoadNativeLibrary)' != 'false'"> <DefineConstants>$(DefineConstants);PRELOAD_NATIVE_LIBRARY</DefineConstants> </PropertyGroup> </Project> |
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
1 2 3 4 5 6 7 8 9 10 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | /******************************************************** * ADO.NET 2.0 Data Provider for SQLite Version 3.X * Written by Robert Simpson (robert@blackcastlesoft.com) * * Released to the public domain, use at your own risk! ********************************************************/ namespace System.Data.SQLite { using System; #if PRELOAD_NATIVE_LIBRARY || DEBUG using System.Diagnostics; #endif #if PRELOAD_NATIVE_LIBRARY using System.Collections.Generic; using System.IO; using System.Reflection; #endif #if !PLATFORM_COMPACTFRAMEWORK && !DEBUG using System.Security; #endif using System.Runtime.InteropServices; #if !PLATFORM_COMPACTFRAMEWORK && !DEBUG [SuppressUnmanagedCodeSecurity] #endif internal static class UnsafeNativeMethods { #region Optional Native SQLite Library Pre-Loading Code #if PRELOAD_NATIVE_LIBRARY #if !PLATFORM_COMPACTFRAMEWORK /// <summary> /// The name of the environment variable containing the processor /// architecture of the current process. /// </summary> private static readonly string PROCESSOR_ARCHITECTURE = "PROCESSOR_ARCHITECTURE"; #endif ///////////////////////////////////////////////////////////////////////// /// <summary> /// Stores the mappings between processor architecture names and platform /// names. /// </summary> private static Dictionary<string, string> processorArchitecturePlatforms; ///////////////////////////////////////////////////////////////////////// /// <summary> /// This is the P/Invoke method that wraps the native Win32 LoadLibrary /// function. See the MSDN documentation for full details on what it /// does. /// </summary> /// <param name="fileName"> /// The name of the executable library. /// </param> /// <returns> /// The native module handle upon success -OR- IntPtr.Zero on failure. /// </returns> [DllImport("kernel32", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto, #if !PLATFORM_COMPACTFRAMEWORK BestFitMapping = false, ThrowOnUnmappableChar = true, #endif SetLastError = true)] private static extern IntPtr LoadLibrary(string fileName); ///////////////////////////////////////////////////////////////////////// /// <summary> /// The native module handle for the native SQLite library or the value /// IntPtr.Zero. /// </summary> private static IntPtr _SQLiteModule = IntPtr.Zero; ///////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to initialize this class by pre-loading the native SQLite /// library for the processor architecture of the current process. /// </summary> static UnsafeNativeMethods() { // // TODO: Make sure this list is updated if the supported processor // architecture names and/or platform names changes. // if (processorArchitecturePlatforms == null) { processorArchitecturePlatforms = new Dictionary<string, string>(); processorArchitecturePlatforms.Add("X86", "Win32"); processorArchitecturePlatforms.Add("AMD64", "x64"); processorArchitecturePlatforms.Add("IA64", "Itanium"); } // // BUGBUG: What about other application domains? // if (_SQLiteModule == IntPtr.Zero) _SQLiteModule = PreLoadSQLiteDll(null, null); } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Queries and returns the base directory of the current application /// domain. /// </summary> /// <returns> /// The base directory for the current application domain -OR- null if it /// cannot be determined. /// </returns> private static string GetBaseDirectory() { #if !PLATFORM_COMPACTFRAMEWORK return AppDomain.CurrentDomain.BaseDirectory; #else Assembly assembly = Assembly.GetExecutingAssembly(); if (assembly == null) return null; AssemblyName assemblyName = assembly.GetName(); if (assemblyName == null) return null; try { return Path.GetDirectoryName(assemblyName.CodeBase); } catch { // do nothing. } return null; #endif } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Queries and returns the processor architecture of the current /// process. /// </summary> /// <returns> /// The processor architecture of the current process -OR- null if it /// cannot be determined. Always returns an empty string when running on /// the .NET Compact Framework. /// </returns> private static string GetProcessorArchitecture() { #if !PLATFORM_COMPACTFRAMEWORK // // BUGBUG: Will this always be reliable? // return Environment.GetEnvironmentVariable(PROCESSOR_ARCHITECTURE); #else // // BUGBUG: No way to determine this value on the .NET Compact // Framework (running on Windows CE, etc). // return String.Empty; #endif } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Given the processor architecture, returns the name of the platform. /// </summary> /// <param name="processorArchitecture"> /// The processor architecture to be translated to a platform name. /// </param> /// <returns> /// The platform name for the specified processor architecture -OR- null /// if it cannot be determined. /// </returns> private static string GetPlatformName( string processorArchitecture ) { if (String.IsNullOrEmpty(processorArchitecture)) return null; if (processorArchitecturePlatforms == null) return null; string platformName; if (processorArchitecturePlatforms.TryGetValue( processorArchitecture, out platformName)) { return platformName; } if (processorArchitecturePlatforms.TryGetValue( #if !PLATFORM_COMPACTFRAMEWORK processorArchitecture.ToUpperInvariant(), #else processorArchitecture.ToUpper(), #endif out platformName)) { return platformName; } return null; } ///////////////////////////////////////////////////////////////////////// /// <summary> /// Attempts to load the native SQLite library based on the specified /// directory and processor architecture. /// </summary> /// <param name="directory"> /// The base directory to use, null for default (the base directory of /// the current application domain). This directory should contain the /// processor architecture specific sub-directories. /// </param> /// <param name="processorArchitecture"> /// The requested processor architecture, null for default (the /// processor architecture of the current process). This caller should /// almost always specify null for this parameter. /// </param> /// <returns> /// The native module handle as returned by LoadLibrary -OR- IntPtr.Zero /// if the loading fails for any reason. /// </returns> private static IntPtr PreLoadSQLiteDll( string directory, string processorArchitecture ) { // // NOTE: If the specified base directory is null, use the default. // if (directory == null) directory = GetBaseDirectory(); // // NOTE: If we failed to query the base directory, stop now. // if (directory == null) return IntPtr.Zero; // // NOTE: If the native SQLite library exists in the base directory // itself, stop now. // string fileName = Path.Combine(directory, SQLITE_DLL); if (File.Exists(fileName)) return IntPtr.Zero; // // NOTE: If the specified processor architecture is null, use the // default. // if (processorArchitecture == null) processorArchitecture = GetProcessorArchitecture(); // // NOTE: If we failed to query the processor architecture, stop now. // if (processorArchitecture == null) return IntPtr.Zero; // // NOTE: Build the full path and file name for the native SQLite // library using the processor architecture name. // fileName = Path.Combine(Path.Combine(directory, processorArchitecture), SQLITE_DLL); // // NOTE: If the file name based on the processor architecture name // is not found, try using the associated platform name. // if (!File.Exists(fileName)) { // // NOTE: Attempt to translate the processor architecture to a // platform name. // string platformName = GetPlatformName(processorArchitecture); // // NOTE: If we failed to translate the platform name, stop now. // if (platformName == null) return IntPtr.Zero; // // NOTE: Build the full path and file name for the native SQLite // library using the platform name. // fileName = Path.Combine(Path.Combine(directory, platformName), SQLITE_DLL); // // NOTE: If the file does not exist, skip trying to load it. // if (!File.Exists(fileName)) return IntPtr.Zero; } try { // // NOTE: Show exactly where we are trying to load the native // SQLite library from. // Trace.WriteLine(String.Format( "Trying to load native SQLite library \"{0}\"...", fileName)); // // NOTE: Attempt to load the native library. This will either // return a valid native module handle, return IntPtr.Zero, // or throw an exception. // return LoadLibrary(fileName); } catch (Exception e) { try { // // NOTE: First, grab the last Win32 error number. // int lastError = Marshal.GetLastWin32Error(); // // NOTE: Show where we failed to load the native SQLite // library from along with the Win32 error code and // exception information. // Trace.WriteLine(String.Format( "Failed to load native SQLite library \"{0}\" " + "(getLastError = {1}): {2}", fileName, lastError, e)); /* throw */ } catch { // do nothing. } } return IntPtr.Zero; } #endif #endregion ///////////////////////////////////////////////////////////////////////// #if !SQLITE_STANDARD #if !USE_INTEROP_DLL #if !PLATFORM_COMPACTFRAMEWORK private const string SQLITE_DLL = "System.Data.SQLite.dll"; #else |
︙ | ︙ |