[IronPython] Compiling with Pyc for Silverlight

Dino Viehland dinov at microsoft.com
Mon Apr 20 13:30:55 PDT 2009


How do you serialize the Assembly object?  If it's easy enough we could presumably
add this to support Silverlight natively - I'd love to have pre-compiled support
there.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Monday, April 20, 2009 1:24 PM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Compiling with Pyc for Silverlight
> 
> Dino Viehland wrote:
> > An easy starting point would be to use ildasm + a Python script +
> ilasm.  There's also CCI (just released on CodePlex last week) or Cecil
> which could also probably both be used for the task.
> >
> 
> I'll start with ildasm. I looked at Cecil but it was a bit low level.
> I've also been looking into the CompileModules source code. It doesn't
> look impossible to get this actually working on Silverlight and
> serialize out rather than try to save to disk (ScriptCode and
> ScriptCode.SaveToAssembly are all public where a lot of the work is
> done).
> 
> I'll try ildasm first.
> 
> Michael
> > I can only assume this exception is coming from having the assembly
> identities being different - but it's strange because it does seem to
> be looking in the 2.0.5.0 assembly, which is Silverlight, and the type
> is definitely in there.  Hopefully re-writing the binaries will make
> this go away.
> >
> >
> >
> >
> >> -----Original Message-----
> >> From: users-bounces at lists.ironpython.com [mailto:users-
> >> bounces at lists.ironpython.com] On Behalf Of Michael Foord
> >> Sent: Monday, April 20, 2009 12:43 PM
> >> To: Discussion of IronPython
> >> Subject: Re: [IronPython] Compiling with Pyc for Silverlight
> >>
> >> Dino Viehland wrote:
> >>
> >>> In theory there's just 1 IL re-write that's required for this to
> >>>
> >> work.  And that should be replacing the references to
> >> mscorlib/IronPython to point at the Silverlight versions.  There's
> no
> >> way to directly have the written binaries target Silverlight because
> >> Reflection Emit has no cross-compilation support :(.
> >>
> >> I need to rewrite references to the IronPython / DLR assemblies to
> use
> >> the Silverlight versions and the same for mscorlib.
> >>
> >> Any pointers as to how I should start?
> >>
> >>
> >>> Do you know what's happening when trying to import packages?
> >>>
> >>>
> >>>
> >> SystemError
> >> at app.py in app.py, line 7 ? SystemError: Could not load type
> >> 'Microsoft.Runtime.CompilerServices.StrongBox`1' from assembly
> >> 'Microsoft.Scripting.Core, Version=2.0.5.0, Culture=neutral,
> >> PublicKeyToken=31bf3856ad364e35'. ? Hide
> >>
> >> Michael
> >>
> >>
> >>>> -----Original Message-----
> >>>> From: users-bounces at lists.ironpython.com [mailto:users-
> >>>> bounces at lists.ironpython.com] On Behalf Of Michael Foord
> >>>> Sent: Monday, April 20, 2009 3:34 AM
> >>>> To: Discussion of IronPython
> >>>> Subject: [IronPython] Compiling with Pyc for Silverlight
> >>>>
> >>>> Hello guys,
> >>>>
> >>>> I'd like to modify Pyc to work with Silverlight. I tried it with
> >>>>
> >> simple
> >>
> >>>> modules and it works straightforwardly - but I have a report that
> it
> >>>> doesn't work with packages.
> >>>>
> >>>> I'll try it - but if anyone has any idea of how to modify the
> >>>>
> >> bytecode
> >>
> >>>> generation to target the CoreCLR it would be appreciated. As far
> as
> >>>>
> >> I
> >>
> >>>> can tell from looking at the source it isn't adding any direct
> >>>> references to the desktop assemblies. Any clues as to what changes
> I
> >>>> should make? (Other than running from Silverlight and serializing
> >>>>
> >> the
> >>
> >>>> generated assemblies from memory to base64 which I would prefer to
> >>>> avoid...).
> >>>>
> >>>> Michael
> >>>>
> >>>> --
> >>>> http://www.ironpythoninaction.com/
> >>>> http://www.voidspace.org.uk/blog
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Users mailing list
> >>>> Users at lists.ironpython.com
> >>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >>>>
> >>>>
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at lists.ironpython.com
> >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >>>
> >>>
> >> --
> >> http://www.ironpythoninaction.com/
> >> http://www.voidspace.org.uk/blog
> >>
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.ironpython.com
> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >>
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> 
> 
> --
> http://www.ironpythoninaction.com/
> http://www.voidspace.org.uk/blog
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Users mailing list