I am currently working on a C# project that contains UDP and TCP connections, and outputs to a serial port,... etc...

So I was thinking ... How hard is it to take a C# program and convert it somehow to be embedded on a circuit board? ... i.e: replacing the laptop with a circuit board and components with the software running on it

I know that it is more achievable with C ... but I am asking about C# specifically

Thanks :)

Very hard. C# depends on the CLR library being installed on the machine. You'd have to include it in your embedded system.

Very hard. C# depends on the CLR library being installed on the machine. You'd have to include it in your embedded system.

Thanks for replying ...but:

Has anyone tried to actually embed CLR before? or you are just suggesting it?

Well, the DLLs for .NET 4.0 are about 92 meg in size. Sure, you don't need them all, but you'll need some of them. Also, C# isn't compiled into machine code, it's compiled into IL (which has to conform to the CLI specification. When you actually run the program a JIT compiler converts it to machine code.

So, you'd need to write something that pulls just the parts you need out of the DLLs and compiles the code into machine code. Not trivial :)

Well, the DLLs for .NET 4.0 are about 92 meg in size. Sure, you don't need them all, but you'll need some of them. Also, C# isn't compiled into machine code, it's compiled into IL (which has to conform to the CLI specification. When you actually run the program a JIT compiler converts it to machine code.

So, you'd need to write something that pulls just the parts you need out of the DLLs and compiles the code into machine code. Not trivial :)

OK ... now I'm sure it's tough :D ... but I understand the problem more clearly ...

So... Do you know any tutorial or guide to do those things, however hard it is?

This article has been dead for over six months. Start a new discussion instead.