Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Binary python extensions with Free Pascal Compiler

25 views
Skip to first unread message

Caleb Hattingh

unread,
Mar 16, 2006, 3:49:03 PM3/16/06
to
Hi all

I want to write python extensions with FPC (Free Pascal Compiler,
http://www.freepascal.org). In Delphi, this is trivially easy due to
the great work of the P4D (Python-for-Delphi, http://mmm-experts.com/)
guys; however, when aiming for cross-platform binary extensions, that
strategy naturally doesn't work.

FPC has great cross-platform support, and to date I have written
library units that compile to .dlls (on win32) and .so's (on posix),
and then used these via ctypes. This has worked very well, but for
certain applications I would prefer to create a new python type via
binary extension, rather than a python class with method wrappers
around library calls. I could just use C, I guess, but I have a large
amount of pascal code that I would like to use, and I would prefer not
to fiddle with a C-binary extension intermediate.

I have explored the python.h header, and as expected, there appears to
be much use of the C standard library. Using a tool that converts a C
header into an object pascal unit (intended to be the interface to
python.dll) gets me some of the way, but of course, calls to the C
stdlib don't get automatically translated into equivalent pascal-coded
functionality. I'm afraid I am answering my own question here: is the
only way of getting this working to change all the stdlib calls in my
newly created pascal unit (created from python.h) to matching
functionality in pascal?

If there is another, simpler way I'm just not seeing, I would be glad
to hear it.

Regards
Caleb

Ravi Teja

unread,
Mar 16, 2006, 3:59:50 PM3/16/06
to
I posted this a few days ago. According to the website
(http://mmm-experts.com/VersionHistory.aspx?ProductId=3), FPC support
has been added since version 3.29.

Caleb Hattingh

unread,
Mar 16, 2006, 4:03:19 PM3/16/06
to
Well, there it is:

* Added support for Free Pascal Compiler (http://www.freepascal.org/)
and Lazarus Project (http://www.lazarus.freepascal.org/)
Thanks to Michiel du Toit (micd...@hsbfn.com)

That was easy. I just saw the new support for D2k6 recently.

thx Ravi
Caleb

0 new messages