ASDAlexander77 / cs2cpp

C# to C++ transpiler (Cs2Cpp) (Powered by Roslyn)
http://csnative.codeplex.com
254 stars 62 forks source link

Really great project - What's about NetStandard #2

Open bernd5 opened 7 years ago

bernd5 commented 7 years ago

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

ASDAlexander77 commented 7 years ago

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 commented 7 years ago

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

ASDAlexander77 commented 7 years ago

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

bernd5 commented 7 years ago

Great to hear

ASDAlexander77 commented 7 years ago

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 commented 7 years ago

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

jacano commented 7 years ago

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?

ASDAlexander77 commented 7 years ago

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