I want to ask something about unmanaged code such as COM:
COM codes is equal to specific OS code
Then OS translates the COM code into machine code
Or is COM codes simply machine code
Please respectively answer 3 questions in detail.
JohnWen
There's no such thing as "COM codes", COM is a component model. COM object may be implemented in native or managed code.
Depends on the object. An object can be implemented in whatever programming language a user sees fit. That could be C++, C#, VB, assembler, etc.
john wen wrote:
Is COM object implemented in machine code
Or is COM object implemented in specific Operating System code
John Wen
4 - July - 07
There's no such thing as "operating system code" when implementing a COM object. Do you mean a specific Operating System's API
IL is OS inspecific. Using "operating system code" as a synonym for "IL" doesn't make sense. The OS does none of the translating; it's the framework that does the translating (in this case the .NET framework).
A COM object can be native code (pre-compiled to machine code), managed code (IL), interpretted code, etc. It's up to the developer to decide what language/framework they want to implement their object in.
john wen wrote:
What form is the COM object implemented in Machine code or higher level code
We've already answered that a couple of times in this thread. It can be both.
john wen wrote:
Since I always thought the Operating System was a translator which translates specific OS code into machine code, I want you to tell me if Operating System is translator or not
The OS is not a translator in the way you're suggesting.
It depends on how the developer coded the COM object. There's basically three three ways of deploying compiled code: native, intermediate language, or interpreted.
john wen wrote:
"What form is the COM object implemented in Machine code or higher level code We've already answered that a couple of times in this thread. It can be both"
If the COM object is implemented in higher level code, then I am eager to know how can that higher level code be translated or changed into machine code Note that in the past I thought it was Operating system which did such translation.
John Wen
5 - July - 07
Native means that machine code is generated at compile time, for a specific processor or processor instruction set. The code is ready to run and nothing needs to be translated, the OS simply points the instruction at an entry point and starts running.
Intermediate language requires a runtime, or framework. The code is compiled into a binary that kickstarts that runtime when first accessed. It's that runtime that checks to see if IL to machine translation has been done or not and does the translation if needed. Once the translation has been done that generated machine code is stored for later use and likely never needs to be generated again.
Interpreted is similar to IL but the machine code executed is transient (in memory) and doesn't stick around after the code has been executed.
If you're writing COM objects in a .NET language you'll always be in the IL case. A COM object is a binary that has registered entry points. With a .NET COM object those entry points point to stubs or proxies that first go into the framework to initialize it and begin the just-in-time (JIT) compilation process, if needed. Once the framework is initialized and the machine code is generated it is then called. The next time those entry points are called they'll effectively go right into the machine code.
What are you interested in this sort of thing