Embedding python with lcc-win32

Gerhard =?unknown-8bit?Q?H=E4ring?= gh_pythonlist at gmx.de
Mon Feb 18 04:04:15 EST 2002


Le 17/02/02 ? 03:39, decay écrivit:
> ae98096 at aero.iitm.ernet.in (decay) wrote in message news:<335764c1.0202161031.425dd81a at posting.google.com>...
> > Hello.
> > 
> > I've been trying to embed python in a C program. I use the lcc-win32
> > compiler system. I made an import library from python21.dll using
> > implib. But when I link a simple program, I get "Undefined reference
> > to __imp__Py_Initialize" in test.c. I suppose its got to do with
> > making the import library. Can anyone please enlighten me?
>
> I got my simple python-embedded-in-C program (read below) to compile
> with lcc-win32 by doing the following:
> 
> I used buildlib with the following file as argument:
> -----------------
> python21.dll
> __imp__PyArg_Parse PyArg_Parse
> __imp__PyArg_ParseTuple PyArg_ParseTuple
> ...
> -----------------
> 
> The program now compiles, but when I execute it, it "caused an error
> in <unknown>". Can anyone tell me what's happening?

Out of interest, I've tried to look at lcc-win32 again. It looks like
you didn't convert the MSVC-style python22.lib. Do that (Tools/Import
library or some such) and then just add "python22.lib" to your libraries
list. A minimal test program then runs fine on my machine, except it
crashes somewhere after "return 0" in the main function. I guess the
reason is that lcc-win32 links against the darn crtdll. If you use
msvcrt.dll like Python does, you should be fine.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 4.6 °C      Wind: 2.8 m/s




More information about the Python-list mailing list