diff --git a/.gitignore b/.gitignore
index 485b985..788e171 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,8 @@
/HostWithHostFxr/bin/Debug
/HostWithHostFxr/src/.vs/HostWithHostFxr
/HostWithHostFxr/src/DotNetLib/obj
-/HostWithHostFxr/src/NativeHost/bin/Debug/net5.0
+/HostWithHostFxr/src/NativeHost/bin/Debug/
/HostWithHostFxr/src/NativeHost/Debug
/HostWithHostFxr/src/NativeHost/obj
+**/.idea/
+/HostWithHostFxr/src/HostWithHostFxr.sln.DotSettings.user
diff --git a/HostWithHostFxr/src/DotNetLib/DotNetLib.csproj b/HostWithHostFxr/src/DotNetLib/DotNetLib.csproj
index 07ea8c2..ecaf450 100644
--- a/HostWithHostFxr/src/DotNetLib/DotNetLib.csproj
+++ b/HostWithHostFxr/src/DotNetLib/DotNetLib.csproj
@@ -1,8 +1,9 @@
- net5.0
+ net6.0
true
+ 10
diff --git a/HostWithHostFxr/src/DotNetLib/Lib.cs b/HostWithHostFxr/src/DotNetLib/Lib.cs
index 60d68d1..fc4d182 100644
--- a/HostWithHostFxr/src/DotNetLib/Lib.cs
+++ b/HostWithHostFxr/src/DotNetLib/Lib.cs
@@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
+using System.Globalization;
namespace DotNetLib
{
@@ -27,11 +28,42 @@ public static int Hello(IntPtr arg, int argLength)
return 0;
}
+ public static int TestCultureInfoCompareInfo(IntPtr arg, int argLength)
+ {
+ String[] sign = new String[] { "<", "=", ">" };
+
+ // The code below demonstrates how strings compare
+ // differently for different cultures.
+ String s1 = "Coté", s2 = "coté", s3 = "côte";
+
+ // Set sort order of strings for French in France.
+ CompareInfo ci = new CultureInfo("fr-FR").CompareInfo;
+ Console.WriteLine("The LCID for {0} is {1}.", ci.Name, ci.LCID);
+
+ // Display the result using fr-FR Compare of Coté = coté.
+ Console.WriteLine("fr-FR Compare: {0} {2} {1}",
+ s1, s2, sign[ci.Compare(s1, s2, CompareOptions.IgnoreCase) + 1]);
+
+ // Display the result using fr-FR Compare of coté > côte.
+ Console.WriteLine("fr-FR Compare: {0} {2} {1}",
+ s2, s3, sign[ci.Compare(s2, s3, CompareOptions.None) + 1]);
+
+ // Set sort order of strings for Japanese as spoken in Japan.
+ ci = new CultureInfo("ja-JP").CompareInfo;
+ Console.WriteLine("The LCID for {0} is {1}.", ci.Name, ci.LCID);
+
+ // Display the result using ja-JP Compare of coté < côte.
+ Console.WriteLine("ja-JP Compare: {0} {2} {1}",
+ s2, s3, sign[ci.Compare(s2, s3) + 1]);
+
+ return 0;
+ }
+
public delegate void CustomEntryPointDelegate(LibArgs libArgs);
public static void CustomEntryPoint(LibArgs libArgs)
{
- Console.WriteLine($"Hello, world! from {nameof(CustomEntryPoint)} in {nameof(Lib)}");
- PrintLibArgs(libArgs);
+ Console.WriteLine("-------");
+ TestCultureInfoCompareInfo(libArgs.Message, libArgs.Number);
}
#if NET5_0
diff --git a/HostWithHostFxr/src/NativeHost/NativeHost.csproj b/HostWithHostFxr/src/NativeHost/NativeHost.csproj
index 66e5e7c..d510c78 100644
--- a/HostWithHostFxr/src/NativeHost/NativeHost.csproj
+++ b/HostWithHostFxr/src/NativeHost/NativeHost.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
@@ -92,7 +92,7 @@
+ />
+ />
NativeHost
10.0
-
Application
true
@@ -52,7 +51,6 @@
true
Unicode
-
@@ -160,7 +158,6 @@
-
diff --git a/HostWithHostFxr/src/NativeHost/Properties/launchSettings.json b/HostWithHostFxr/src/NativeHost/Properties/launchSettings.json
index 4781387..2ce8be8 100644
--- a/HostWithHostFxr/src/NativeHost/Properties/launchSettings.json
+++ b/HostWithHostFxr/src/NativeHost/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"NativeHost": {
"commandName": "Executable",
- "executablePath": "$(SolutionDir)\\..\\bin\\$(Configuration)\\nativehost.exe",
+ "executablePath": "$(MSBuildProjectDirectory)/../../bin/Debug/nativehost",
"nativeDebugging": true
}
}
diff --git a/HostWithHostFxr/src/NativeHost/nativehost.cpp b/HostWithHostFxr/src/NativeHost/nativehost.cpp
index 6dffe1a..96c8371 100644
--- a/HostWithHostFxr/src/NativeHost/nativehost.cpp
+++ b/HostWithHostFxr/src/NativeHost/nativehost.cpp
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
//
const string_t dotnetlib_path = root_path + STR("DotNetLib.dll");
const char_t *dotnet_type = STR("DotNetLib.Lib, DotNetLib");
- const char_t *dotnet_type_method = STR("Hello");
+ const char_t *dotnet_type_method = STR("TestCultureInfoCompareInfo");
//
// Function pointer to managed delegate
component_entry_point_fn hello = nullptr;
@@ -115,19 +115,19 @@ int main(int argc, char *argv[])
const char_t *message;
int number;
};
- for (int i = 0; i < 3; ++i)
{
//
lib_args args
{
STR("from host!"),
- i
- };
-
+ 0
+ };
hello(&args, sizeof(args));
- //
+
}
+ //
+
#ifdef NET5_0
// Function pointer to managed delegate with non-default signature
typedef void (CORECLR_DELEGATE_CALLTYPE *custom_entry_point_fn)(lib_args args);