You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+10-6
Original file line number
Diff line number
Diff line change
@@ -38,17 +38,18 @@ dotnet_typedef! {
38
38
```
39
39
40
40
With this approach, the classes and APIs exposed to .NET can be easily used from other .NET languages, like F# or C#. The safety of this glue layer can be checked by the Rust compiler, which should make interop issues much less likely.
41
+
41
42
## C support
42
43
43
-
While .NET is the main foccus of my work, this project can also be used to compile Rust to C, by setting the `C_MODE` enviroment flag to `1`.
44
+
While .NET is the main focus of my work, this project can also be used to compile Rust to C, by setting the `C_MODE` enviroment flag to `1`.
44
45
45
46
This may seem like a strange and unrelated feature, but the project was written in such a way that this is not only possible, but relatively easy.
46
47
47
48
My representation of .NETs IR maps nicely to C, which means that I was able to add support for compiling Rust to C in 2-3K LOC. Almost all of the codebase is reused, with the C and .NET specific code only
48
49
present in the very last stage of compilation.
49
50
50
-
This means that, instead of having to maintain 2 separate projects, I can maintian one project. Bug fixes to the .NET side of things also fix C bugs.
51
-
Because of that, the support for C in the project is almost as good as support for .NET
51
+
This means that, instead of having to maintain 2 separate projects, I can maintain one project. Bug fixes to the .NET side of things also fix C bugs.
52
+
Because of that, the support for C in the project is almost as good as support for .NET
52
53
53
54
## Current state of the project
54
55
@@ -60,7 +61,9 @@ Currently, the GCC and clang C compilers are supported, with plans to add suppor
60
61
for `tcc`, and maybe even `sdcc`.
61
62
62
63
So, you *can* compile a lot of existing Rust code, but it may not necessarily *work*.
64
+
63
65
### core, std, and alloc uint tests.
66
+
64
67
.NET
65
68
66
69
| Name | Pass | Faliure | Crash \ Timeout| OK precentage
@@ -77,6 +80,7 @@ C
77
80
| Name | Pass | Faliure | OK precentage
78
81
|--------------------|--------|-------|------|
79
82
| Core tests | 1419 | 294 | 82.83% |
83
+
80
84
## FAQ
81
85
82
86
### Q: What is it?
@@ -99,16 +103,16 @@ C
99
103
100
104
**A**: *`rustc_codegen_clr` is only tested on Linux x86_64, with the CoreCLR runtime (more commonly known as simply the .NET runtime), on .NET 8. It should work on other platforms, but it is not guaranteed.*
101
105
102
-
### Q: Whata about Mono?
103
-
**A***The support for the Mono runtime is not as good as it could be. Due to not supported features and differences, 128-bit integers and checked 64-bit integer arithmetic are not supported on Mono.*
106
+
### Q: What about Mono?
107
+
108
+
**A**: *The support for the Mono runtime is not as good as it could be. Due to not supported features and differences, 128-bit integers and checked 64-bit integer arithmetic are not supported on Mono.*
104
109
*Aligned allocators(__rust_alloc) and certain intrinsics are also not supported. I plan to expand support for Mono, but my resources are limited.*
105
110
106
111
### Q: Are there any issues?
107
112
108
113
**A**: *While the backend is extensively tested, it is still far from perfect, and there are still many edge cases that may break this backend.*
109
114
**A**: *Currently, there are no .NET-specific versions of `std` or .NET specific target triples. This means that you will need separate .NET assemblies for each OS.*
110
115
111
-
112
116
## Licensing
113
117
114
118
`rustc_codegen_clr` is dual licensed under MIT license or Apache License, Version 2.0.
0 commit comments