Nellrun/python4delphi

Does not work in 64-bit environment

Closed this issue · 4 comments

What steps will reproduce the problem?
1. Create a sample application in Delphi XE2 targeting the Win64 platform, 
using Python 2.7 (win64 build)
2. Run the application and note the errors.

The first error appears in the MapDll() routine in PythonEngine.pas. The 64-bit 
version of Py_InitModule4() is renamed Py_InitModule4_64().

After this change is made, everything will compile but upon execution, access 
violations will be present.

I tracked this problem down to differences in the expected sizes of data 
structures. Removing the "packed" directive fixes the issues, and appears to 
work in both the 32 and 64-bit builds.

I have attached the modified PythonEngine.pas to this issue for your 
consideration.

Original issue reported on code.google.com by alan.kra...@gmail.com on 27 Oct 2011 at 4:49

Attachments:

Many thanks for the patch. I am quite interested in supporting the 64 bit 
version of Delphi.

I haven't yet have access to Delphi XE2. Could you please check that the 
assembler stuff in MethodCallBack.pas work (I very much doubt it)?   And also 
the VarPyth.pas.  Could you test some of the demos?


Original comment by pyscripter on 28 Oct 2011 at 1:26

  • Changed state: Accepted
I downloaded the Delphi XE2 30-day trial from Embarcadero, and have been 
evaluating it to see how difficult it will be to move our existing Delphi 2009 
projects and components to 64-bits. I have 9 days left on the trial, so if I 
have time, I'll try and go through more of the tests.

The assembly code will most likely need to be altered - that is for sure.

Original comment by alan.kra...@gmail.com on 28 Oct 2011 at 4:09

A quick note or two:

1. I had to update Definitions.inc to take into account Delphi XE & XE2 
compiler versions - file is attached.

2. The 64-bit assembler code (or lack of it) in the previously uploaded 
PythonEngine.pas is rubbish. I totally forgot that I put some IFDEFs in there 
to get it to compile, and upon running some of the demos, I'm getting access 
violations and such. Demo 1 and 2 work as expected, however.

Original comment by alan.kra...@gmail.com on 28 Oct 2011 at 6:15

Attachments:

Original comment by pyscripter on 15 Dec 2011 at 2:34

  • Changed state: Fixed