dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.36k stars 4.75k forks source link

Replace Win32 API types with standard types #4068

Open janhenke opened 9 years ago

janhenke commented 9 years ago

Currently all the internal API uses Win32 API types like DWORD.

Refactoring the code to use C/C++ standard types would have several benefits.

In general the currently used types are very alien for every Unix developer. In view of the cross platform goal of coreclr this would be a big step forward to opening up and be more inclusive towards new developers.

jkotas commented 9 years ago

This was discussed on gitter no so long ago ...

CoreCLR codebase has a Win32 bias. PAL was designed to make it work as is. Wholesale replacement of Win32 types with stdint.h types would remove some of the Win32 bias, but I doubt that it would move the needle enough to make a difference.

I would love to see portability cleanup - like adopting stdint.h types - to be done for the parts of the tree that are likely to evolve into reusable components. GC is one that we know about so far. My comment in https://github.com/dotnet/coreclr/issues/270 touched on this subject as well. PRs to make GC more portable, with less Win32 artifacts are welcomed.

Our strategy is to migrate most of the runtime code from C++ to C#. It is what we have been spending our energy in the low-level BCL land, instead of trying to polish the C++ implementation.

Porting to C# is fixing whole bunch of problems at once: no interop overhead, no buggy "manually managed" code, no need to deal with C++ compiler quirks on different platforms ... and no Win32 types too.

janhenke commented 9 years ago

Thanks @jkotas for that explanation. Sounds like a good plan to me.

I also see this more as a long term goal as I am aware we are not going to change code just for the sake of removing the Win32 types. But it should stand as one of the things to do when someone is doing a code cleanup anyway.

Maybe you or somebody else from Microsoft can create a Wiki page, which lists the different parts of the code base, the status each has right now and the strategic goals for that part. So people can get an overview in which direction certain parts should evolve.

So I would like to keep this issue open as a long term tracking on how far we are with removing the Win32 bias in the code base.

jkotas commented 8 years ago

GC cleanup done as dotnet/coreclr#2110

ghost commented 2 years ago

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of the experimental issue cleanup initiative we are currently trialing. Please share any feedback you might have in the linked issue.

janhenke commented 2 years ago

I still consider this an important long term goal and would like to keep this issue open.