Freigeben über


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" ?>

<configuration>

  <configSections>

    <section name="microsoft.scripting"

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

             requirePermission="false" />

  </configSections>

  <microsoft.scripting>

    <languages>

      <language names="IronPython,Python,py"

                extensions=".py"

                displayName="IronPython 2.0 Beta"

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

      <language names="IronRuby;Ruby,rb"

                extensions=".rb"

                displayName="IronRuby 1.0 Alpha"

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

    </languages>

  </microsoft.scripting>

</configuration>

2) Calling the following methods

ScriptRuntimeSetup srs = ScriptRuntimeSetup.ReadConfiguration();

ScriptRuntime runtime = new ScriptRuntime(srs);

Comments

  • RednaxelaFX
  • Anonymous
    September 08, 2008
    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...

  • Anonymous
    September 11, 2008
    Due to the recent changes to the DLR Hosting API , dlr hosts now have to use the App.Config file to configure

  • Anonymous
    September 16, 2008
    With 2.0 Beta 5 coming out very soon, there is a new hosting helper class in there called IronPython.Hosting.Python

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

  • Anonymous
    September 23, 2008
    With 2.0 Beta 5 coming out very soon, there is a new hosting helper class in there called IronPython.Hosting.Python