I've been following the debate with some interest - although I'm no expert on compilers.
My work involves a lot of data processing, for which I use Python scripts from which I can call functions coded in Pascal (and other languages).
The interfacing works as follows: Pascal modules are linked statically to some C interface code (which converts Python objects to/ from C types). The C interface code is compiled to Python compatible DLLs, which can be imported directly into Python. I'm sure there are other ways to achieve the same end (and it would be nicer to be able to do the conversion to/from Python objects in Pascal) - but it works. I use the MinGW compiler to compile my code. The extensions work with the standard (MSVC) Python distribution.
As long as there is a straightforward means of creating Python binary extensions from Pascal source code I'll be happy - but since Python is written in C the C++ solution sounds more promising, so I will vote for that.
Andrew.
http://www.npl.co.uk/materials/ http://www.npl.co.uk/electromagnetic/
------------------------------------------------------------------- This e-mail and any attachments may contain confidential and/or privileged material; it is for the intended addressee(s) only. If you are not a named addressee, you must not use, retain or disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881 Registered Office: Serco House, 16 Bartley Wood Business Park, Hook, Hampshire, United Kingdom RG27 9UY -------------------------------------------------------------------
Andrew Gregory wrote:
My work involves a lot of data processing, for which I use Python scripts from which I can call functions coded in Pascal (and other languages).
I have the same system, but with TclTk instead of Python. But I don't use C wrappers. After some fiddling around a few years back, I figured out how to make the wrappers in Pascal. But the net result is: I can call functions from the TclTk command line that are implemented in Pascal. I can do the same for C and Fortran too, as I describe in the following page, for whoever else wants to do it. That's why compatibility between GPC and libraries compiled by GCC remains a priority for me.
http://alignment.hep.brandeis.edu/Software/Mixing/Mixing_Manual.html
Yours, Kevan
On Thu, 12 Aug 2010 07:55:23 pm Andrew Gregory wrote:
My work involves a lot of data processing, for which I use Python scripts from which I can call functions coded in Pascal (and other languages).
I'm very interested to read this, because writing Python extensions in Pascal is in my To Do list.
The interfacing works as follows: Pascal modules are linked statically to some C interface code (which converts Python objects to/ from C types). The C interface code is compiled to Python compatible DLLs, which can be imported directly into Python.
I don't suppose you could point me to a walk-through or beginner's tutorial? I haven't done any serious Pascal programming since the late 1980s using THINK Pascal on the Apple Mac, and so I've missed out on much of the Pascal-to-C linking stuff.
Thanks,
Dear Steve,
I don't suppose you could point me to a walk-through or beginner's tutorial?
Andrew will answer for the Python connection, but when it comes to mixing Pascal, C, C++, and Fortran using GCC, I have a tutorial here:
http://alignment.hep.brandeis.edu/Software/Mixing/Mixing_Manual.html
My application runs on TclTk, another multi-platform interpreter, and I build extensions for TclTk in Pascal.
Yours, Kevan