DLR Hosting API : latest version of the spec is available online (includes changes to runtime initialization)

The latest version of the Hosting API spec is available here. The most recent source code drop to the IronPython codeplex site conforms to this spec (except for some open bugs).

The biggest change this spec introduces to the beta4 binaries is the way the hosting runtime is initialized.

Prior to this update, the hosting runtime is initialized by creating a new ScriptRuntime object. Now, a typical runtime initialization involves 2 things.

A quick 5 min how-to on the new initialization is as follows

1)      Setting up entries in the application’s config file. Here is a sample config file

<?xml version="1.0" encoding="utf-8" ?>



    <section name="microsoft.scripting" 

             type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting, Version=, Culture=neutral, publicKeyToken=31bf3856ad364e35"     

             requirePermission="false" />





      <language names="IronPython,Python,py"


                displayName="IronPython 2.0 Beta"

                type="IronPython.Runtime.PythonContext,IronPython, Version=, Culture=neutral, publicKeyToken=31bf3856ad364e35" />

      <language names="IronRuby;Ruby,rb"


                displayName="IronRuby 1.0 Alpha"

                type="IronRuby.Runtime.RubyContext, IronRuby, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>





2)      Calling the following methods

ScriptRuntimeSetup srs = ScriptRuntimeSetup.ReadConfiguration();

ScriptRuntime runtime = new ScriptRuntime(srs);

Comments (7)

  1. RednaxelaFX says:


    A question: according to the spec, the names in these two lines should have been "semicolon-separated", right?

    <language names="IronPython,Python,py"

    <language names="IronRuby;Ruby,rb"


    – RednaxelaFX

  2. seshapv says:

    re : RednaxelaFX

    Ah yes, I think you’ve caught a spec bug. The spec says its semi colon separated. But the code that parses these ids accepts a comma as well.

    I will follow up with our PM and make the necessary changes to the spec.

    thanks for the comment…

  3. Due to the recent changes to the DLR Hosting API , dlr hosts now have to use the App.Config file to configure

  4. With 2.0 Beta 5 coming out very soon, there is a new hosting helper class in there called IronPython.Hosting.Python

  5. DLR(Dynamic Language Runtime)是Silverlight中提供的一套非常强大的动态语言运行时。目前2.0 beta2中支持Python,Ruby和JSX。 利用DLR,你可以很方便的使用熟悉的动态语言编写Silverlight程序。

  6. With 2.0 Beta 5 coming out very soon, there is a new hosting helper class in there called IronPython.Hosting.Python

Skip to main content