[IronPython] Embedding Question

Shri Borde Shri.Borde at microsoft.com
Fri Aug 11 00:42:03 CEST 2006


Another alternative is:

ClrModule clr = (ClrModule)engine.Import("clr");
clr.AddReference(typeof(SomeAutoCadType).Assembly);

This is similar to doing "engine.LoadAssembly(typeof(SomeAutoCadType).Assembly)", but is more robust since it also updates "clr.References". PythonEngine.LoadAssembly should be deprecated in favor of ClrModule.AddReference.

Shri

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Slide
Sent: Thursday, August 10, 2006 3:02 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Embedding Question

There is also an Import method on the PythonEngine object that allows you to import stuff programatically as well.

On 8/10/06, Kristof Wagemans <kristof.wagemans at gmail.com> wrote:
>
>
>
>
> Isn't engine.LoadAssembly(typeof(SomeAutoCadType).Assembly)
> easier or is this different in some way?
>
>
>
>  ________________________________
>
>
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
>  Sent: Thursday 10 August 2006 21:17
>
>  To: Discussion of IronPython
>  Subject: Re: [IronPython] Embedding Question
>
>
>
>
>
>
>
> Cool, looks like I was only close though J You may have already
> imported clr into the default module, but just for the record for
> those who haven't you'll need an import clr there.  I just realized I forgot it the 1st time,
> and I had a redundant "AddReference" in the delegate call.   I'm assuming
> you just fixed all that up, but just in case anyone else needs to do
> something like this, here's the correct code:
>
>
>
> delegate void AddReference(object assembly);
>
> AddReference adr = engine.CreateMethod<AddReference>("import
> clr\nclr.AddReference(assembly)");
>
> adr(typeof(SomeAutoCadType).Assembly);
>
>
>
> _______________________________________________
> 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



More information about the Ironpython-users mailing list