cs2cpp icon indicating copy to clipboard operation
cs2cpp copied to clipboard

Really great project - What's about NetStandard

Open bernd5 opened this issue 7 years ago • 8 comments

Hi Alex,

first of all I would like to thank you very much for contributing your great cs2cpp project to us. Actually it generates really good and readable C++ Code - much better than CoreRT (it's more low-level).

For me it would be really nice if your CoreLib-implemantion would support netstandard (e.g. 1.4). I saw you integrated many tests from Microsoft to your project (good idea). So I tried to execute them. The first issue for me was that I had to adjust your paths in CompilerHelper.cs - it would be good if there would be relative to the repository. Then I tried to execute some of the tests but they failed again - System.Globalization.Calender was not found what I couldn't believe (In the past I had a lot of issues with "finding code"). But then I checked the CoreLib directory - and it was really not there - but I found it in mscorlib dir. So my question is: Where you got the CSharp source code for the CoreLib and mscorlib - which version? What is your preferred lib (CoreLib or mscorelib)? How many MS-tests are successfull?

Can we help you?

Greetings,

Bernd

bernd5 avatar May 09 '17 21:05 bernd5

FOA Thank you for your interest.

  1. I am planning to migrate from CoreLib to .NET Core CoreLib. Initially I was using Mscorlib from .NET Micro as CoreLib this is why you can't find a lot of classes there. I have tried to use original Mscorlib but it contains tons of useless classes so it was not practical to use it

  2. Yes, many tests are not working now as they rely on internal native implementation which I am missing at that moment. Additionally many tests using a lot of Reflection functionality which I am not supporting at that moment. So I am using Test_Mono_Tests and Test_Mono_GTests.

  3. What is your preferred lib (CoreLib) My preferred is CoreLib but now I am really thinking to adjust support for .NET CoreLib (from CoreRT, not from CoreFX) and drop Mscorlib at all

  4. Can we help you? I need help with native implementation which can be used from CoreRT but I just need minimum functionality as I want to have cross platform compilation ability and to have minimum dependency. This is why I am compiling a lot of "code" into CoreLib header.

ASDAlexander77 avatar May 10 '17 08:05 ASDAlexander77

Additionally I would like to implement PInvoke as many C# projects as Avalonia rely on it

ASDAlexander77 avatar May 10 '17 08:05 ASDAlexander77

I am working on functionality to compile mscorlib from CoreCLR. Many things already done

ASDAlexander77 avatar Jul 11 '17 10:07 ASDAlexander77

Great to hear

bernd5 avatar Jul 12 '17 20:07 bernd5

finally finished cleaning up the code to compile CoreCLR mscorlib.

to do so you need to do few steps

  1. git clone https://github.com/dotnet/coreclr.git
  2. cd coreclr
  3. init-tools.cmd
  4. cd ..
  5. Cs2Cpp.exe /release C:\Dev\Gits\coreclr\src\mscorlib\System.Private.CoreLib.csproj
  6. cd System.Private.CoreLib
  7. build_prerequisite_vs2017_release.bat
  8. build_vs2017_release.bat

ok, now you have lib (size 350mb) but it will have missing native functions. I am working on it to be able to compile exe file

ASDAlexander77 avatar Jul 13 '17 12:07 ASDAlexander77

Now you can compile CoreCLR and CoreFX projects

Cs2Cpp.exe /release <path_to_git>\coreclr\src\mscorlib\System.Private.CoreLib.csproj

Cs2Cpp.exe /release <path_to_git>\corefx\src\System.Private.Uri\src\System.Private.Uri.csproj /corelib:System.Private.CoreLib.dll /p:Configuration=netstandard2.0-Windows_NT-Release

ASDAlexander77 avatar Jul 21 '17 09:07 ASDAlexander77

Great work, you made an awesome job there reusing a modern mscorlib such as System.Private.CoreLib Just wondering, did you make some progress on the internal native implementation of reflection or still missing? Do you have any roadmap or plan for it?

jacano avatar Jul 21 '17 23:07 jacano

I did work a bit with reflection and native implementation (only required minimum). Idea was to reuse native implementation from CoreCLR or CoreRT but I am not there yet

ASDAlexander77 avatar Jul 25 '17 08:07 ASDAlexander77