sillsdev / icu-dotnet

C# wrapper for ICU4C
MIT License
62 stars 33 forks source link

Use NativeLibrary for all OSes #200

Closed imnasnainaec closed 4 months ago

imnasnainaec commented 4 months ago

At a high level these changes make sense to me. Other than the one thing I pointed out with dlerror, my only concern is how much testing this might need on Windows and Linux to make sure there isn't some unexpected impact. NativeLibrary should work fine, but I don't think the unit tests really exercise dynamic library loading deeply (e.g., does NativeLibrary follow all the same path searching rules that libdl uses?). I'm guessing it will not be a problem, but that's just a guess.

@lyonsil Yeah, I was having similar concerns, so I left this in draft until it could be given more thorough consideration.

github-actions[bot] commented 4 months ago

Test Results

       5 files  ±0     403 suites  ±0   5s :stopwatch: -1s    431 tests ±0     427 :heavy_check_mark: ±0    4 :zzz: ±0  0 :x: ±0  2 193 runs  ±0  2 095 :heavy_check_mark: ±0  98 :zzz: ±0  0 :x: ±0 

Results for commit 41370224. ± Comparison against base commit fddc930f.

:recycle: This comment has been updated with latest results.

imnasnainaec commented 4 months ago

Looks good to me. The overall question about "how do we know that NativeLibrary will be functionally compatible with the previous approach for Windows and Linux users on .NET 6.0 or later?" is still there, but I don't see anything in these changes that looks like a regression or a problem.

I'll try to test it out more.

For reference, here's the code NativeLibrary uses: for Unix; for Windows

imnasnainaec commented 4 months ago

For Unix, it uses [LibraryImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_LoadLibrary", StringMarshalling = StringMarshalling.Utf8)] (in Interop.Sys)