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 Framework support #19

Open
Titas22 opened this issue Jan 5, 2023 · 4 comments
Open

.NET Framework support #19

Titas22 opened this issue Jan 5, 2023 · 4 comments
Labels
help wanted Extra attention is needed .NET Framework

Comments

@Titas22
Copy link

Titas22 commented Jan 5, 2023

Hi,

Are there any plans to add .NET Framework support in the future? In particular I am interested in versions 4.7/4.8.

Is Framework not supported because it is not really cross-platform compatible and woud mainly work on windows? Or does it simply need some work to get it working? If so and since you've already done all this great work to support .NET Core, do you know what specifically is missing to support the Framework as well.

Would be nice to have a list of what is missing to make this happen.

@azurefx
Copy link
Owner

azurefx commented Jan 8, 2023

I don't have this plan at present because there are two main considerations:

First, according to Microsoft, .NET Framework 4.8 will be the last version of .NET Framework. Starting from .NET 5, there will be no distinction between "Windows-only .NET" and "cross-platform .NET", and .NET includes most of the features provided by .NET Framework. Due to the backward compatibility of the .NET runtime, if you have an assembly developed for .NET Framework 4.7/4.8, there is a high probability that it will run on subsequent .NET versions. Therefore, supporting .NET Framework seems less necessary.

Second, the .NET Framework hosting APIs are exposed as COM interfaces, and it is cumbersome to implement interoperability with COM in Julia. For API documentation, please refer to this link.

Please correct me if I am wrong. If you're interested in adding support for .NET Framework, I'd be glad to help.

@Titas22
Copy link
Author

Titas22 commented Jan 8, 2023

You're right that the future versions of .NET will all be compatible between platforms and it should be fairly easy to upgrade most projects to .NET 5/6/7. However, in my case (and I'm sure there will be many others in similar position), there are 3rd party projects that I must use which for one or other reason have not yet upgraded and/or are not even planning to. In those cases the only real solution is to find a way to support .NET framework in Julia. There might be a way to write wrappers to get this working through Python or maybe .NET Standard, but that would add overhead and be more complicated than it could be.

Second point sounds like a fairly valid reason, I have not really used COM much and definitely not in Julia so can't really comment on how difficult it would be.

I might take a look when I have some time but not sure I'm there yet with Julia to be able to add .NET Framework support 😅

@azurefx
Copy link
Owner

azurefx commented Jan 8, 2023

I've tried implementing COM calls in Julia a few years ago, but didn't come up with a convenient package. If I have time I'll finish it first and publish as a standalone package.

@Tyrion3000
Copy link

Tyrion3000 commented Mar 25, 2024

@azurefx I may not be of much help but I think there may be a tool that might help you out. It's known as SharpGenTools and one they may help out further is SharpGen.Runtime.COM. You may need both tools.

SharpGenTools is a code generator that generates C# for interoperation with C++ and COM libraries. It generates efficient C# code and handles all of the native marshalling. Additionally, it includes an assembly patcher to use CLR instructions not available from C# to further minimize the overhead of the generated code.

SharpGenTools has a post-processing patching step to patch in unmanaged calli instructions to actually do native calls on vtables. SharpGenTools mappings are configured through XML files that are effectively like scripts. All of the script options are documented in SharpGenTools' documentation, but the documentation is not currently set up to show up in any IDE environments, making it difficult for users to discover the various options without knowing where the documentation is located.

This is julia we're talking about though, So I could be very wrong but Julia was implemented mostly in LLVM, largely with C, C++ and if anything that needs scheme, there is IronScheme, which could further iron-out some things, though that may not be necessary, I am not fully sure but the codebase is still active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed .NET Framework
Projects
None yet
Development

No branches or pull requests

3 participants