Subset implementation for CompactFramework
I was wondering if I could get some insight into how much of the Python for .NET framework could be ported to the Compact Framework? Python is still my language of choice, and it would be wonderful to use it to develop on the PocketPC. This framework seems to be the ideal interop layer to help me do this effectively. Currently we have two separable goals. First is to be able to use python libraries from VB or C# on the PocketPC. Second is to be able to use WindowsForms exclusively from python. In my investigation, I worked through compiling pythonnet for the compact framework, and found a heavy dependence on system.reflection.emit, which is not available on the Compact Framework. (Which makes me grumpy, but that's another matter ;) This brings me to the question of how much of pythonnet is dependent on system.reflection.emit? Can we achieve either of the above goals? If it is possible, I'd love to help move this forward for the crippled Compact Framework. In this case, I'd like to talk with someone to get an overview of the architecture. Thanks! -Shane Holloway
Hi Shane - Unfortunately I'm not really up to speed on exactly what is and isn't supported on the compact framework. Its disappointing to hear that emit isn't supported -- that's likely to be a problem for getting any dynamic language to run on CF :( PythonNet currently uses reflection.emit for two things: - generating IJW thunks to a few functions in the C Python runtime (essentially calling function pointers that are only known at runtime and can't be dealt with using p/invoke or other approaches) - creating types on the fly to implement delegates that call back into python code It would probably be possible to avoid (1) by statically generating and linking the thunk code that otherwise would be done at runtime with a bit of manual labor. (2) is more problematic -- we currently generate a delegate type for each unique actual delegate type that is used from Python code (this could be optimized in the future to only generate a distinct type per signature). So when, for example, you say from Python: def myhandler(sender, args): print 'myhandler called!' someobject.SomeEvent += myhandler what happens is: - the pythonnet runtime generates a type that acts as a dispatcher that matches the Invoke signature of SomeEvent (or re-uses a previously generated type if a dispatcher has already been created for that delegate type) - an instance of the generated type is instantiated passing the callable python object that it should dispatch to and that instance is what managed code sees Its been awhile since I looked at that part of the code, but I'm not sure if there is a way around code gen in some form in this case. I tried to do the 'simplest thing that could possibly work' there, but I'd be happy to be wrong ;) Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
-----Original Message----- From: pythondotnet-bounces@python.org [mailto:pythondotnet-bounces@python.org]On Behalf Of Shane Holloway (IEEE) Sent: Monday, July 25, 2005 11:18 AM To: pythondotnet@python.org Subject: [Python.NET] Subset implementation for CompactFramework
I was wondering if I could get some insight into how much of the Python for .NET framework could be ported to the Compact Framework? Python is still my language of choice, and it would be wonderful to use it to develop on the PocketPC. This framework seems to be the ideal interop layer to help me do this effectively. Currently we have two separable goals. First is to be able to use python libraries from VB or C# on the PocketPC. Second is to be able to use WindowsForms exclusively from python.
In my investigation, I worked through compiling pythonnet for the compact framework, and found a heavy dependence on system.reflection.emit, which is not available on the Compact Framework. (Which makes me grumpy, but that's another matter ;) This brings me to the question of how much of pythonnet is dependent on system.reflection.emit? Can we achieve either of the above goals?
If it is possible, I'd love to help move this forward for the crippled Compact Framework. In this case, I'd like to talk with someone to get an overview of the architecture.
Thanks! -Shane Holloway _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet
participants (2)
-
Brian Lloyd
-
Shane Holloway (IEEE)