Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a CLR that runs on the CLR?

Tags:

.net

clr

cil

I was wondering if there was a .NET-compatible CLR that was implemented using the CLI (common language infrastructure), e.g., using .NET itself, or at least if there were any resources that would help with building one.

Basically, something like a .NET program that loads assemblies as MemoryStreams, parses the bytecode, constructs the types, and executes the instructions. Optionally, it can JIT-compile to standard IL using Reflection.Emit or however.

I don't want to compile a .NET language to be run by the original CLR. I want a CLR that's written in a .NET language (not unmanaged C++ or C as it usually is) and runs CIL. If done right, it should be able to run itself.

Any thoughts on using Mono.Cecil for this kind of thing?

like image 462
Mark Cidade Avatar asked Sep 30 '08 00:09

Mark Cidade


People also ask

What is CLR integration?

For SQL Server users and application developers, CLR integration means that you can now write stored procedures, triggers, user-defined types, user-defined functions (scalar and table valued), and user-defined aggregate functions using any . NET Framework language, including Microsoft Visual Basic .

What is the purpose of the common language runtime?

The Common Language Runtime (CLR) is programming that manages the execution of programs written in any of several supported languages, allowing them to share common object-oriented classes written in any of the languages. It is a part of Microsoft's . NET Framework.

What is Azure CLR?

With the Common Language Runtime (CLR) hosted in Microsoft SQL Server (called CLR integration), you can author stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates in managed code. CLR is also available in Azure SQL Database Managed Instance.


2 Answers

I don't think there are currently any standalone .net VMs that are self hosting but both Cosmos and SharpOS are .net runtimes written in C#.

It may be possible to reuse some of their runtime code to extra a standalone runtime. Cosmos can be used to host a custom application on boot: http://www.codeproject.com/KB/system/CosmosIntro.aspx

like image 147
Luke Quinane Avatar answered Sep 28 '22 22:09

Luke Quinane


You should check out the IKVM.NET Project. It includes a Java Virtual Machine written in .NET.

http://www.ikvm.net/

I know it's not an actual CLR that runs on top of the CLR, but it's the closest thing I know of that does what you want.

like image 35
Chris Pietschmann Avatar answered Sep 28 '22 23:09

Chris Pietschmann