Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ied206 committed Aug 7, 2023
2 parents edbeb93 + d097eba commit 41963a5
Show file tree
Hide file tree
Showing 24 changed files with 596 additions and 167 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ bld/
[Ll]og/

# Do not ignore Precompiled directory
!/**/Precompiled/x86/
!/**/Precompiled/x64/
!/**/Precompiled/armhf/
!/**/Precompiled/arm64/
!/**/runtimes/**/native/

# Thumbs.db
Thumbs.db

# macOS DS_Store guard
.DS_Store
Expand Down Expand Up @@ -173,6 +173,7 @@ AutoTest.Net/
# Installshield output folder
[Ee]xpress/


# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
Expand Down
31 changes: 24 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@

## v2.x

### v2.2.0

Released on 2023-08-08.

- Allow passing a custom object when loading a native library.
- Add `LoadManagerBase.GlobalInit()` overloadings with custom object parameter.
- Add `DynLoaderBase.LoadLibrary()` overloadings with custom object parameter.
- Add virtual method `DynLoaderBase.HandleLoadData()`.
- Add helper method `DynLoaderBase.HasFuncSymbol()`.

### v2.1.1

Released on 2022-02-15.

- Official support for ARM64 macOS.
- Unify .NET Framework 4.5.1 codebase and .NET Standard 2.0 codebase.

### v2.1.0

Release in 2021.04.05.
Released on 2021-04-05.

- Avoid calling virtual methods from constructors in `DynLoaderBase`.
- Users must call `DynLoaderBase.LoadLibrary` after creating an instance.
Expand All @@ -14,7 +31,7 @@ Release in 2021.04.05.

### v2.0.0

Released in 2020.04.24.
Released on 2020-04-24.

- Use `NativeLoader` on .NET Core 3.x build.
- `DynLoaderBase` now throws [DllNotFoundException](https://docs.microsoft.com/en-US/dotnet/api/system.dllnotfoundexception) and [EntryPointNotFoundException](https://docs.microsoft.com/en-US/dotnet/api/system.entrypointnotfoundexception) instead of [ArgumentException](https://docs.microsoft.com/en-US/dotnet/api/system.argumentexception) and [InvalidOperationException](https://docs.microsoft.com/en-us/dotnet/api/system.invalidoperationexception).
Expand All @@ -30,31 +47,31 @@ Released in 2020.04.24.

### v1.3.0

Released in 2020.02.29.
Released on 2020-02-29.

- Add `size_t` helper methods.
- Rename AutoStringToCoTaskMem() into StringToCoTaskMemAuto().

### v1.2.1

Released in 2019.10.31.
Released on 2019-10-31.

- Address `libdl.so` naming issue for CentOS ([#1](https://github.com/ied206/Joveler.DynLoader/issues/1))

### v1.2.0

Released in 2019.10.16.
Released on 2019-10-16.

- Add platform convention helper properties and methods

### v1.1.0

Released in 2019.10.15.
Released on 2019-10-15.

- Add `LoadManagerBase` abstract class

### v1.0.0

Released in 2019.10.15.
Released on 2019-10-15.

- The initial release of the cross-platform native dynamic library loader for .NET.
4 changes: 2 additions & 2 deletions Joveler.DynLoader.Tests/GhostErrorTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2019-2021 Hajin Jang
Copyright (C) 2019-2023 Hajin Jang
Licensed under MIT License.
MIT License
Expand Down Expand Up @@ -59,7 +59,7 @@ public void LoadFunctionError()
try
{
GhostFunction lib = new GhostFunction();
lib.LoadLibrary(TestSetup.PackagedZLibPath);
lib.LoadLibrary(TestSetup.PackagedZLibPathStdcall);
}
catch (EntryPointNotFoundException e)
{
Expand Down
31 changes: 18 additions & 13 deletions Joveler.DynLoader.Tests/Joveler.DynLoader.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Windowws x86 & x64 -->
<TargetFrameworks>net48;net6.0</TargetFrameworks>
<!-- Windowws ARM64 -->
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT' and '$(PROCESSOR_ARCHITECTURE)' == 'ARM64'">net6.0</TargetFrameworks>
<!-- Windowws -->
<TargetFrameworks>net481;net6.0</TargetFrameworks>
<!-- POSIX -->
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net6.0</TargetFrameworks>

Expand All @@ -19,13 +17,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -48,8 +46,8 @@
</Content>
</ItemGroup>

<!-- Native Library for .NET Framework 4.8 -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<!-- Native Library for .NET Framework 4.8.1 -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net481' ">
<None Include="runtimes\win-x86\native\*.dll">
<Link>x86\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand All @@ -58,12 +56,16 @@
<Link>x64\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="runtimes\win-arm64\native\*.dll">
<Link>arm64\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- Unfortanately, MSBuild does not support Condition on Import. -->
<!-- <Import Project="$(MSBuildProjectDirectory)\SampleScript.netfx.targets" -->

<!-- Native Library for .NET Core 2.1 & 3.1 -->
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp3.1'">
<!-- Native Library for .NET Core -->
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<None Include="runtimes\win-x86\native\*.dll">
<Link>runtimes\win-x86\native\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down Expand Up @@ -92,7 +94,10 @@
<Link>runtimes\osx-x64\native\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="runtimes\osx-arm64\native\*.dylib">
<Link>runtimes\osx-arm64\native\%(FileName)%(Extension)</Link> <!-- Project Reference -->
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>


</Project>
2 changes: 1 addition & 1 deletion Joveler.DynLoader.Tests/PlatformConventionTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2020 Hajin Jang
Copyright (C) 2020-2023 Hajin Jang
Licensed under MIT License.
MIT License
Expand Down
42 changes: 35 additions & 7 deletions Joveler.DynLoader.Tests/SampleScript.netfx.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
HasTrailingSlash('$(MSBuildThisFileDirectory)')">
<InteropLibFiles_x86 Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\*.dll" />
<InteropLibFiles_x64 Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x64\native\*.dll" />
<InteropLibFiles_arm64 Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64\native\*.dll" />
</ItemGroup>
<ItemGroup Condition="'$(ExcludeInteropMgc)' != 'true' And
'$(MSBuildThisFileDirectory)' != '' And
Expand All @@ -55,6 +56,10 @@
<Link>x64\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Condition="'@(InteropLibFiles_arm64)' != ''" Include="@(InteropLibFiles_arm64)">
<Link>arm64\%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup Condition="'$(ExcludeInteropMgc)' != 'true'">
<None Condition="'@(InteropMgcFiles)' != ''" Include="@(InteropMgcFiles)">
Expand Down Expand Up @@ -89,6 +94,16 @@
<Copy SourceFiles="@(InteropLibFiles_x64)"
DestinationFiles="@(InteropLibFiles_x64 -> '$(OutDir)x64\%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyInteropLibFiles_arm64"
Condition="'$(CopyInteropLibFiles_arm64)' != 'false' And
'$(OutDir)' != '' And
HasTrailingSlash('$(OutDir)') And
Exists('$(OutDir)')"
Inputs="@(InteropLibFiles_arm64)"
Outputs="@(InteropLibFiles_arm64 -> '$(OutDir)x86\%(Filename)%(Extension)')">
<Copy SourceFiles="@(InteropLibFiles_arm64)"
DestinationFiles="@(InteropLibFiles_arm64 -> '$(OutDir)arm64\%(Filename)%(Extension)')" />
</Target>
<Target Name="CopyInteropMgcFiles"
Condition="'$(CopyInteropMgcFiles)' != 'false' And
'$(OutDir)' != '' And
Expand Down Expand Up @@ -118,6 +133,13 @@
Exists('$(OutDir)')">
<Delete Files="@(InteropLibFiles_x64 -> '$(OutDir)x64\%(Filename)%(Extension)')" />
</Target>
<Target Name="CleanInteropLibFiles_arm64"
Condition="'$(CleanInteropLibFiles_arm64)' != 'false' And
'$(OutDir)' != '' And
HasTrailingSlash('$(OutDir)') And
Exists('$(OutDir)')">
<Delete Files="@(InteropLibFiles_arm64 -> '$(OutDir)arm64\%(Filename)%(Extension)')" />
</Target>
<Target Name="CleanInteropMgcFiles"
Condition="'$(CleanInteropMgcFiles)' != 'false' And
'$(OutDir)' != '' And
Expand Down Expand Up @@ -146,6 +168,14 @@
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="CollectInteropLibFiles_arm64"
Condition="'$(CollectInteropLibFiles_arm64)' != 'false'">
<ItemGroup>
<FilesForPackagingFromProject Include="@(InteropLibFiles_arm64)">
<DestinationRelativePath>bin\arm64\%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="CollectInteropMgcFiles"
Condition="'$(CollectInteropMgcFiles)' != 'false'">
<ItemGroup>
Expand All @@ -166,18 +196,21 @@
$(PostBuildEventDependsOn);
CopyInteropLibFiles_x86;
CopyInteropLibFiles_x64;
CopyInteropLibFiles_arm4;
CopyInteropMgcFiles;
</PostBuildEventDependsOn>
<BuildDependsOn>
$(BuildDependsOn);
CopyInteropLibFiles_x86;
CopyInteropLibFiles_x64;
CopyInteropLibFiles_arm64;
CopyInteropMgcFiles;
</BuildDependsOn>
<CleanDependsOn>
$(CleanDependsOn);
CleanInteropLibFiles_x86;
CleanInteropLibFiles_x64;
CleanInteropLibFiles_arm64;
CleanInteropMgcFiles;
</CleanDependsOn>
</PropertyGroup>
Expand All @@ -188,16 +221,11 @@
******************************************************************************
-->

<PropertyGroup Condition="'$(VisualStudioVersion)' == '' Or
'$(VisualStudioVersion)' == '10.0' Or
'$(VisualStudioVersion)' == '11.0' Or
'$(VisualStudioVersion)' == '12.0' Or
'$(VisualStudioVersion)' == '14.0' Or
'$(VisualStudioVersion)' == '15.0' Or
'$(VisualStudioVersion)' == '16.0'">
<PropertyGroup>
<PipelineCollectFilesPhaseDependsOn>
CollectInteropLibFiles_x86;
CollectInteropLibFiles_x64;
CollectInteropLibFiles_arm64;
CollectInteropMgcFiles;
$(PipelineCollectFilesPhaseDependsOn);
</PipelineCollectFilesPhaseDependsOn>
Expand Down
7 changes: 6 additions & 1 deletion Joveler.DynLoader.Tests/SimpleFIleMagicManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
/*
Written by Hajin Jang.
Released under public domain.
*/

using System;

namespace Joveler.DynLoader.Tests
{
Expand Down
2 changes: 1 addition & 1 deletion Joveler.DynLoader.Tests/SimpleFileMagicTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2019-2021 Hajin Jang
Copyright (C) 2019-2023 Hajin Jang
Licensed under MIT License.
MIT License
Expand Down
2 changes: 1 addition & 1 deletion Joveler.DynLoader.Tests/SimplePlatformTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2019-2021 Hajin Jang
Copyright (C) 2019-2023 Hajin Jang
Licensed under MIT License.
MIT License
Expand Down
Loading

0 comments on commit 41963a5

Please sign in to comment.