Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

Binary python extensions with Free Pascal Compiler

瀏覽次數:25 次
跳到第一則未讀訊息

Caleb Hattingh

未讀,
2006年3月16日 下午3:49:032006/3/16
收件者:
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

未讀,
2006年3月16日 下午3:59:502006/3/16
收件者:
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

未讀,
2006年3月16日 下午4:03:192006/3/16
收件者:
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 則新訊息