[fpc-pascal] Python

Xealot xealot at gmail.com
Mon Feb 16 01:55:33 CET 2009


Hello everyone,

I appologize if this is not the correct mailing list for this kind of
question.

I want to use Python from my application, i found a couple of ways to do
this. either use P4D in Windows (which would not compile on my 64 bit
system, and is not cross platform), I can translate the necessary functions
and classes from the python header files myself (h2pas wont work) and work
directly against the library..

Or the third option, which I tried on linux.. which is to write the code
that actually uses python in C, compile it with gcc and then link the
resulting .o file into the rest of my application and use that. With this
method, I can use all of pythons API without having to translate its
headers, This trick worked in Linux when I tested it, but im having issues
in Windows

Whilst the compile of the actual C code worked, I simply cannot use the
Python25.dll from my code,  Heres how I did it:

unit pyinterface;

{$link py.o}
{$linklib python25}
{$linklib c}

On windows, I used the MingW compiler so linklib c was to be replaced with
the appropriate libraries (msvcrt etc.) but this is not the issue,

the problem here is that when I try to linklib python25, It produces:

C:\test\C>C:\FPC\2.2.2\bin\i386-win32\ppcrossx64.exe
-FlE:\mingw-w64-bin_i686-mi
ngw_20090213\x86_64-pc-mingw32\lib64 -FlC:\test\C -FoE:\Python25\libs
foo.pas
foo.pas(19,1) Error: Import library not found for python25

doesnt matter if i put python25 or python25.dll in the linklib line, and the
DLL is present both in my System32 directory, as well as in the local one
where all the source code for my demo project is in.

You can find my linux demo source at:

http://xealot.winsbydefault.com/py_interface.tar.bz2

thanks for taking your time reading this,

 - Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20090216/4cb4ea0e/attachment.html>


More information about the fpc-pascal mailing list