Patent ID: 7730473

Claim:
A system, including a computer to execute native code as unmanaged code from a common language runtime environment, comprising: an application module including managed code applications; a compiler to compile the managed code applications to an intermediate language that is executable in a virtual environment of the common language runtime environment, wherein one or more of the managed code applications include a call to an unmanaged native code function, wherein the compiler is configured to: calculate argument offsets to pass arguments from the managed code to the unmanaged native code function, generate marshalling language code to marshall data between the managed code and the unmanaged native code function, and set the marshalling language code into an assembly, wherein the assembly is configured as a set of loadable modules, including the argument offsets, the intermediate language code of the managed code, and metadata; and a common language runtime system to host the virtual environment within the common language runtime environment, to execute the compiled managed code within the virtual environment, and to call the unmanaged native code function from the virtual environment in accordance with the assembly, including to perform the following within the virtual environment: load a native library and a dynamic link library entry point into memory, locate an address of the unmanaged native code function, create a native stub to provide a link between the virtual environment and outside of the virtual environment, and execute the native stub and transfer control from the virtual environment to the outside of the virtual environment.