[IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Mike Krell
I have an unmanaged app written in C++ / MFC that I'd like to script
in some capacity with IronPython.  I can see perhaps three broad
approaches to doing this:

1.  Somehow hosting IP within the app.  This would be the ideal, but I
don't know if it's possible.  It's clear that I would need to create
some wrappers that mediate between managed and unmanaged code (i.e.,
expose functionality as CLR objects).  But on top of that I'd need to
host IP in the process.  I have Michael F.'s excellent IronPython in
Action and have been reading a little bit about embedding the engine,
but it starts with the premise that the hosting app is itself managed.

2. Create a new managed app that would have access to the wrappers as
in #1 and embed IP in that.  I think this is definitely possible, but
it would have limitations that #1 would not have (e.g., in #1, the
user could still do things from the app's gui)

3.  Have a new managed app that runs as a separate process and
communicates with the unmanaged app, e.g. like COM.  The app currently
does not have COM interfaces and working with COM is a major pain.  Is
there an alternative in the .net world that would be similar but
easier to use?

Thanks in advance for any guidance y'all can offer.

   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Curt Hagenlocher
Is there any reason you wouldn't just do this with CPython? In a past life,
I had a lot of success embedding CPython into a C++ / MFC application.

On Tue, May 12, 2009 at 7:48 AM, Mike Krell mbk.li...@gmail.com wrote:

 I have an unmanaged app written in C++ / MFC that I'd like to script
 in some capacity with IronPython.  I can see perhaps three broad
 approaches to doing this:

 1.  Somehow hosting IP within the app.  This would be the ideal, but I
 don't know if it's possible.  It's clear that I would need to create
 some wrappers that mediate between managed and unmanaged code (i.e.,
 expose functionality as CLR objects).  But on top of that I'd need to
 host IP in the process.  I have Michael F.'s excellent IronPython in
 Action and have been reading a little bit about embedding the engine,
 but it starts with the premise that the hosting app is itself managed.

 2. Create a new managed app that would have access to the wrappers as
 in #1 and embed IP in that.  I think this is definitely possible, but
 it would have limitations that #1 would not have (e.g., in #1, the
 user could still do things from the app's gui)

 3.  Have a new managed app that runs as a separate process and
 communicates with the unmanaged app, e.g. like COM.  The app currently
 does not have COM interfaces and working with COM is a major pain.  Is
 there an alternative in the .net world that would be similar but
 easier to use?

 Thanks in advance for any guidance y'all can offer.

   Mike
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Mike Krell
On Tue, May 12, 2009 at 7:58 AM, Curt Hagenlocher c...@hagenlocher.org wrote:
 Is there any reason you wouldn't just do this with CPython? In a past life,
 I had a lot of success embedding CPython into a C++ / MFC application.

Yes, in fact, I've done a limited version of my approach #2 before
using boost.python.  The big win with using IronPython scripting is
access to .net libraries.  Plus I like pushing the envelope -- as
opposed to pushing boulders uphill :-)

   Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Scripting an unmanaged app with IronPython?

2009-05-12 Thread Steve Baer

Hi Mike,
I did this by creating a C++/CLI DLL that wraps our C++ exported 
classes/functions for .NET. This way there is no .NET code in our core 
C++/MFC executable and you get the effect of IP being hosted in the 
application.


Thanks,
-Steve


- Original Message - 
From: Mike Krell mbk.li...@gmail.com

To: Discussion of IronPython users@lists.ironpython.com
Sent: Tuesday, May 12, 2009 8:12 AM
Subject: Re: [IronPython] Scripting an unmanaged app with IronPython?


On Tue, May 12, 2009 at 7:58 AM, Curt Hagenlocher c...@hagenlocher.org 
wrote:
Is there any reason you wouldn't just do this with CPython? In a past 
life,

I had a lot of success embedding CPython into a C++ / MFC application.


Yes, in fact, I've done a limited version of my approach #2 before
using boost.python.  The big win with using IronPython scripting is
access to .net libraries.  Plus I like pushing the envelope -- as
opposed to pushing boulders uphill :-)

  Mike
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com