Skip to content

Commit 349a494

Browse files
committed
undo, for now, the changes made by #663 to src/tests
1 parent 5066380 commit 349a494

2 files changed

Lines changed: 52 additions & 8 deletions

File tree

src/tests/my_batteries_v2.cs

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2014-2026 SourceGear, LLC
2+
Copyright 2014-2019 SourceGear, LLC
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,13 +14,55 @@ You may obtain a copy of the License at
1414
limitations under the License.
1515
*/
1616

17+
using System;
18+
using System.Collections.Generic;
19+
using System.Reflection;
20+
using System.IO;
21+
1722
namespace SQLitePCL
1823
{
1924
public static class Batteries_V2
2025
{
26+
class MyGetFunctionPointer : IGetFunctionPointer
27+
{
28+
readonly IntPtr _dll;
29+
public MyGetFunctionPointer(IntPtr dll)
30+
{
31+
_dll = dll;
32+
}
33+
34+
public IntPtr GetFunctionPointer(string name)
35+
{
36+
if (NativeLibrary.TryGetExport(_dll, name, out var f))
37+
{
38+
//System.Console.WriteLine("{0}.{1} : {2}", _dll, name, f);
39+
return f;
40+
}
41+
else
42+
{
43+
return IntPtr.Zero;
44+
}
45+
}
46+
}
47+
static IGetFunctionPointer MakeDynamic(string name, int flags)
48+
{
49+
// TODO should this be GetExecutingAssembly()?
50+
var assy = typeof(SQLitePCL.raw).Assembly;
51+
var dll = SQLitePCL.NativeLibrary.Load(name, assy, flags);
52+
var gf = new MyGetFunctionPointer(dll);
53+
return gf;
54+
}
55+
static void DoDynamic_cdecl(string name, int flags)
56+
{
57+
var gf = MakeDynamic(name, flags);
58+
SQLitePCL.SQLite3Provider_dynamic_cdecl.Setup(name, gf);
59+
SQLitePCL.raw.SetProvider(new SQLite3Provider_dynamic_cdecl());
60+
}
61+
2162
public static void Init()
2263
{
23-
raw.SetProvider(new SQLite3Provider_e_sqlite3());
64+
DoDynamic_cdecl("e_sqlite3", NativeLibrary.WHERE_PLAIN);
2465
}
2566
}
2667
}
68+

src/tests/tests.csproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>$(tfm_net)</TargetFramework>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
44
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6-
<IsPackable>false</IsPackable>
76
</PropertyGroup>
87
<ItemGroup>
9-
<ProjectReference Include="..\SQLitePCLRaw.core\SQLitePCLRaw.core.csproj" />
10-
<ProjectReference Include="..\SQLitePCLRaw.provider.e_sqlite3\SQLitePCLRaw.provider.e_sqlite3.csproj" />
11-
<ProjectReference Include="..\SQLitePCLRaw.ugly\SQLitePCLRaw.ugly.csproj" />
8+
<ProjectReference Include="..\SQLitePCLRaw.core\SQLitePCLRaw.core.csproj" />
9+
<ProjectReference Include="..\SQLitePCLRaw.provider.dynamic_cdecl\SQLitePCLRaw.provider.dynamic_cdecl.csproj" />
10+
<ProjectReference Include="..\SQLitePCLRaw.nativelibrary\SQLitePCLRaw.nativelibrary.csproj" />
11+
<!-- <ProjectReference Include="..\SQLitePCLRaw.batteries_v2.e_sqlite3.dynamic\SQLitePCLRaw.batteries_v2.e_sqlite3.dynamic.csproj" /> -->
12+
<ProjectReference Include="..\SQLitePCLRaw.ugly\SQLitePCLRaw.ugly.csproj" />
1213
</ItemGroup>
1314
<ItemGroup>
14-
<PackageReference Include="SourceGear.sqlite3" Version="$(lib_e_sqlite3_package_reference_version)" />
15+
<PackageReference Include="AltCover" Version="5.3.675" />
16+
<DotNetCliToolReference Include="dotnet-reportgenerator-cli" Version="4.1.10" />
1517
<PackageReference Include="microsoft.net.test.sdk" Version="$(depversion_microsoft_net_test_sdk)" />
1618
<PackageReference Include="xunit" Version="$(depversion_xunit)" />
1719
<PackageReference Include="xunit.runner.visualstudio" Version="$(depversion_xunit_runner_visualstudio)" />

0 commit comments

Comments
 (0)