Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 6 support #219

Closed
usdaud opened this issue Feb 12, 2023 · 11 comments
Closed

.NET 6 support #219

usdaud opened this issue Feb 12, 2023 · 11 comments

Comments

@usdaud
Copy link

usdaud commented Feb 12, 2023

I know there is a lot of issue related with .NET 6.0 (with links on other links) without answer on the question - do you have any plan support or the project abandoned forever?

@3F
Copy link
Owner

3F commented Feb 13, 2023 via email

@3F
Copy link
Owner

3F commented Feb 13, 2023 via email

@usdaud
Copy link
Author

usdaud commented Feb 13, 2023

Thank you for detailed explanation. I'm sorry but I didn't read your stories on Reddit. Think you have a lot of reasons.

Anyway - project right now is fully abandoned. No any problem. I don't use DllExport at all, still searching the Internet for the right tool. I've tried some very basic with your tool - it is not working.

For GitHub the best practices make updates into readme.md related with the current project status. Because .NET Core actually not work at all. I don't know maybe some very old versions still is, but it is exotic. For common case - it is not work and not compatible. I mean .NET 6 (think .NET 7 will be the same issue). Just save a bit time for github travellers.

@3F
Copy link
Owner

3F commented Feb 13, 2023 via email

@usdaud
Copy link
Author

usdaud commented Feb 14, 2023

It is just some kind of term playing. Anyway, 2.1 was release almost 5 year ago and seems the project don't has major release since this period. Frankly speaking - it is mean dead status. Now .NET is not even CORE anymore - it is just .NET. So DllExport do not support .NET ))

Wish you luck and hope you will change you decision.

@3F
Copy link
Owner

3F commented Feb 14, 2023 via email

@ylmw0131
Copy link

ylmw0131 commented Mar 11, 2023

Yes sir! I am also sit here and waiting for hero 3F updates for supporting .Net 6/7 ^_^~ ~

@shyakocat
Copy link

Waiting support for .Net 7.
Maybe there are many solutions to satisfy my requirement, but I still think simply use [DllExport] is elegant.

@3F
Copy link
Owner

3F commented Dec 26, 2024

Thank you all for your interest and patience!
https://mastodon.social/@github3F/113720431233606873

.NET DllExport repo got *almost latest fixes and changes to the upcoming 1.8 release

This week I also started reviewing of my version of IL assembler on coreclr in order to improve my old rebasing or like. But first I need to merge the latest dotnet changes etc:

*dotnet team cut off a lot of things like cvtres res-obj processing and so on but I already had my own implementation around SDK and some other things; so ...

@3F
Copy link
Owner

3F commented Feb 2, 2025

I made the final changes to my old /rebase feature (part of my 3F's IL Assembler) in an attempt to implement support for all modern dotnet versions; So what do we have now:

  1. I extended default types binding for the rebase option.
  2. I implemented .typeref directive for more custom definitions around it
assemblyDecl : '.hash' 'algorithm' int32
            | secDecl
            | asmOrRefDecl
            | '.typeref' dottedName 'at' dottedName
            | '.typeref' dottedName 'any' 'at' dottedName
            | '.typeref' dottedName 'constraint' 'deny'
            | '.typeref' dottedName 'constraint' 'any' 'deny'

details https://github.com/3F/coreclr?tab=readme-ov-file#typeref-custom-definitions

  1. And I came to the conclusion that this is a dead-end solution due to many problems that need to be solved specifically for specific projects (totally not a general solution at all) and/or require re-implementation for lot of types.

I mean my /rebase feature was originally a quick temporary solution as far as I remember this;
Note the other solutions can reach something similar but through host wrapping, like DNNE does.

And ... for DllExport now I'd rather try to analyze other ways for generating more suitable vtfxup thunk stubs and more around these data conversions between but without raising hostfxr etc. Because it is still in demand in addition to modern solutions like AOT.

Anyway, for the upcoming DllExport 1.8 you now have the ability to use many previously unavailable types when targeting modern platforms, for example:

//OK for .NET 9+, .NET 8, .NET 7, .NET 6, .NET 5, netcoreapp3.1, netstandard2.1, ...
[DllExport]
public static int print(int a)
{
    int b = (int)Math.Pow(a, 2);
    Console.WriteLine(System.IO.File.ReadAllText("..."));

    using Cal stub = new(typeof(Class1).Assembly.Location);
    foreach(string name in stub.PE.Export.Names)
    {
        Console.WriteLine(name);
    }

    StringBuilder sb = new();
    sb.Append("b = ");
    sb.Append(b);
    sb.AppendLine();

    Console.Write(sb.ToString());
    return b;
}

Now this or like works well for .NET 9, .NET 8, .NET 7, .NET 6, .NET 5, netcoreapp3.1, netstandard2.1, ...
But most modern types can be still problematic (Span<> etc. are still not supported)

In this case, I recommend netfx natively with LangVersion=latest + any distributable implementation of the modern types.
For example, Span<> and net472 like:

<TargetFramework>net472</TargetFramework>
<LangVersion>latest</LangVersion>
...
<PackageReference Include="System.Memory" Version="4.6.0" />
static YourStaticCtor()
{
    AppDomain.CurrentDomain.AssemblyResolve += (s, a) =>
        a.Name.StartsWith("System.Memory,") ?
            Assembly.LoadFrom(@"path_to\System.Memory.dll") : null;
}
...
[DllExport]
public static void call()
{
    int[] arr = [ 2, 3, 4, 5 ];
    Span<int> ints = arr;
    //...
}

Full netcore support will be considered later only in new ways if it's possible at all without host wrapping, AOT, etc. Otherwise I don't see the point to do something similar to DNNE or like; sorry.

3F's IL Assembler 9.3.0 and DllExport 1.8 are planned to be released this month.

@usdaud
Copy link
Author

usdaud commented Feb 5, 2025

Hello, I'm delighted that .NET support has finally been implemented, especially considering that legacy .NET Framework is now rarely encountered. I've already completed everything needed on DNNE, so I'm not particularly involved with this solution anymore. However, I've written a note about your project on my website https://algotradinglib.com/en/pedia/d/dllexport.html in the fintech section, where it might be used or is already in use. Thank you for your work, and best of luck with further developments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants