From meddington at gmail.com Sat Oct 1 07:44:38 2005 From: meddington at gmail.com (Michael Eddington) Date: Fri, 30 Sep 2005 22:44:38 -0700 Subject: [Python.NET] Updates to callconvutil.cs for .NET 2.0 In-Reply-To: References: <2db0cefa05091512002c49d4b3@mail.gmail.com> Message-ID: <2db0cefa0509302244v6f0badd5mb88f9dfb4f908cca@mail.gmail.com> Rock on, I have Python.NET running under 2.0 using 2005 Beta 2 and the change below. I've tried both the console and embedding in another .NET application. To compile I made my own solution with three projects (console, crl, and runtime). For CRL I used the Visual IL addin to studio. Did a search/replace and whala. mike On 9/19/05, Greg Chapman wrote: > Michael Eddington wrote: > > > Anyone else out there started to mess with Python.NET on the 2.0 > > platform? One of the first hurtles was the output from ildasm does > > not always place the method name on the next line, causing > > callconvutil to place the modopt in the wrong place. I've added a > > regex in to check for and split the method line if the function name > > is found. > > Here's something I just discovered. You can now (in .NET 2.0) apply > the UnmanagedFunctionPointer attribute to delegate types to get them to > work as cdecl. For example: > > [UnmanagedFunctionPointer(CallingConvention.Cdecl)] > public delegate IntPtr UnaryFunc(IntPtr ob); > > >From what I can tell, that delegate type is compatible with any managed > method with the right signature. When called from unmanaged code, such > delegates will use the cdecl convention (this must be done in some kind > of thunk, since the method itself still uses the normal .NET calling > convention). > > Anyway, the upshot is it looks like you can apply that attribute to all > the CallConvCDecl delegates in Interop.cs (removing the CallConvCDecl > attribute, since it's not needed), and then not need callconvutil at > all. > > -- > Greg Chapman > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet > From meddington at gmail.com Sat Oct 8 06:48:09 2005 From: meddington at gmail.com (Michael Eddington) Date: Fri, 07 Oct 2005 21:48:09 -0700 Subject: [Python.NET] Updates to RunString Message-ID: <43474F89.6090508@gmail.com> Been playing around with RunString implementations looking for what works best. Here is my result. I am able to run any python script loaded from file just fine. Also, between calls to RunString local variables are saved just fine. protected static PyDict locals = null; public static PyObject RunString(string code) { PyObject module = ImportModule("__main__"); PyDict globals = new PyDict(Runtime.PyModule_GetDict(module.Handle)); if (locals == null) { locals = new PyDict(Runtime.PyDict_New()); } IntPtr result = Runtime.PyRun_String(code, (IntPtr)257, globals.Handle, locals.Handle); if (result == IntPtr.Zero) { return null; } return new PyObject(result); } From meddington at gmail.com Thu Oct 13 19:36:00 2005 From: meddington at gmail.com (Michael Eddington) Date: Thu, 13 Oct 2005 10:36:00 -0700 Subject: [Python.NET] Version of Python.NET for .NET v2.0 available Message-ID: <2db0cefa0510131036n62aa7c6dn59d859cf55441776@mail.gmail.com> Hey all, I've made my Python.NET v2.0 code available if anyone wants to take a peek at it. Requires Visual Studio 2005 Beta 2 or newer to compile along with the Visual IL add-in. http://sourceforge.net/project/showfiles.php?group_id=149840 mike From pythondotnet at python.org Sat Oct 22 20:49:50 2005 From: pythondotnet at python.org (Collector: Python for .NET Issue ...) Date: Sat, 22 Oct 2005 14:49:50 -0400 Subject: [Python.NET] [PythonNet] 16/ 2 Resolve "pythonw" Message-ID: <20051022190339.88CD42033BF@mail.zope.org> Issue #16 Update (Resolve) "pythonw" Status Resolved, General/bug medium To followup, visit: http://www.zope.org/Members/Brian/PythonNet/Collector/16 ============================================================== = Resolve - Entry #2 by Brian on Oct 22, 2005 2:49 pm Status: Pending => Resolved I've added this for the next release. -BL ________________________________________ = Request - Entry #1 by Anonymous User on Jul 26, 2005 10:13 pm When running pythonnet on windows, it always comes up with a black box. I reckon that this is a bug as it is not (always) desired. Stock python provides a program "pythonw" to turn this off. I request something similar to be done for this. (Alternatively, perhaps pythonnet could be packaged as a python module of sorts, so that I could use this in stock python?) Please email me re any updates: thestar at fussycoder dot id dot au ==============================================================