By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

extending python with a C-written dll

P: n/a
Hi,

I'm trying to make a windows dll reachable from a python script .. and
I'm encountering troubles during link step ..

I use "lcc" to compile and link
I use python 2.3 under win XP

Here's the compile command which seems to work well :
-----------------------------------------------------
lcclnk.exe -entry inithello -dll -o hello.dll hello.obj -L
"C:\python23\libs" python23.lib
Here's the link command which fails:
------------------------------------
lcclnk.exe -entry inithello -dll -o hello.dll hello.obj -L
"C:\python23\libs" python23.lib
Here are the errors :
---------------------
Error c:\...\plugins\hello.c 14 undefined reference to __imp__Py_BuildValue
Error c:\...\plugins\hello.c 46 undefined reference to __imp__Py_InitModule4

Here's the C code which compile but does not link :
--------------------------------------------------

#include <Python.h>

PyObject *helloHello(PyObject *self, PyObject *args)
{
printf("Hello World!");
return Py_BuildValue("i", 1);
}

PyObject *helloHelloString(PyObject *self, PyObject *args)
{
return Py_BuildValue("s", "Hello World!");
}

static char MHello__doc__[] = "This is a simple Python C extension example";
static char Hello__doc__[] = "Prints in the console";
static char HelloString__doc__[] = "Returns message as string";

PyMethodDef helloMethods[] = {
{"Hello", helloHello, METH_VARARGS, Hello__doc__},
{"HelloString", helloHelloString, METH_VARARGS, HelloString__doc__},
{NULL, NULL}
};

void __declspec(dllexport) inithello()
{
(void)Py_InitModule3("hello", helloMethods, MHello__doc__);
}

Can anyone help me?
Jul 18 '05 #1
Share this Question
Share on Google+
24 Replies


P: n/a
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
I'm trying to make a windows dll reachable from a python script..


FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.

--
Grant Edwards grante Yow! I KAISER ROLL?! What
at good is a Kaiser Roll
visi.com without a little COLE SLAW
on the SIDE?
Jul 18 '05 #2

P: n/a
Grant Edwards a écrit :
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:

I'm trying to make a windows dll reachable from a python script..

FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.


Not really a performance reason .. but mainly because I have a huge code
produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C code
...(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help ?
Do you have a link to quickly learn about it ?

The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html

Jul 18 '05 #3

P: n/a
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
I'm trying to make a windows dll reachable from a python script..
FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.


Not really a performance reason .. but mainly because I have a
huge code produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C
code ..(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help?


It lets you easily call functions in DLLs.
Do you have a link to quickly learn about it ?
http://starship.python.net/crew/theller/ctypes/
http://starship.python.net/crew/thel.../tutorial.html
The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html


I think that is unrelated.

--
Grant Edwards grante Yow! I HAVE a towel.
at
visi.com
Jul 18 '05 #4

P: n/a
Grant Edwards a écrit :
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:

I'm trying to make a windows dll reachable from a python script..

FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.


Not really a performance reason .. but mainly because I have a
huge code produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C
code ..(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help?

It lets you easily call functions in DLLs.

Do you have a link to quickly learn about it ?

http://starship.python.net/crew/theller/ctypes/
http://starship.python.net/crew/thel.../tutorial.html

The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html

I think that is unrelated.


OK .. ctypes looks great .. and I plan to use it for futur purposes

The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I
don't even have a python shell to perform the setup)

I'm sure it is possible to use dll-built with it ..
So please .. can you tell me where I can find Py_BuildValue and
Py_InitModule4 to link with ?

Jul 18 '05 #5

P: n/a
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
OK .. ctypes looks great .. and I plan to use it for futur
purposes

The fact is that the python interpreter I use is not a
standard one It is a python interpreter delivered within a
software named Blender. I don't know whether it is possible or
not to add ctypes to it ..(I don't even have a python shell to
perform the setup)

I'm sure it is possible to use dll-built with it .. So please
.. can you tell me where I can find Py_BuildValue and
Py_InitModule4 to link with ?


Sorry, I don't know anything about doing C lanugage extensions
under Windows.

--
Grant Edwards grante Yow! Boy, am I glad it's
at only 1971...
visi.com
Jul 18 '05 #6

P: n/a
> The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I
don't even have a python shell to perform the setup)

I'm sure it is possible to use dll-built with it ..
So please .. can you tell me where I can find Py_BuildValue and
Py_InitModule4 to link with ?


I doubt that adding new modules as dlls is easier than incorporating
pure-python ones or a mixture of both - as ctypes most probably is. After
all, its pythons module loading mechanism that kicks in for all cases.

If ctypes suits your needs outside of blender, I'd go for trying to
incorporate it into the blender interpreter.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #7

P: n/a
Jean-Baptiste PERIN <jb******@yahoo.fr> writes:
Grant Edwards a écrit :
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
>I'm trying to make a windows dll reachable from a python script..

FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.

Not really a performance reason .. but mainly because I have a
huge code produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C
code ..(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help?

It lets you easily call functions in DLLs.
Do you have a link to quickly learn about it ?

http://starship.python.net/crew/theller/ctypes/
http://starship.python.net/crew/thel.../tutorial.html
The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html

I think that is unrelated.


OK .. ctypes looks great .. and I plan to use it for futur purposes

The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I
don't even have a python shell to perform the setup)


You could try to download the ctypes windows installer, use winzip or
equivalent to unpack the contained files (you need _ctypes.pyd, and the
ctypes directory containing __init__.py), and copy them to some
directory where python can find them.

Thomas
Jul 18 '05 #8

P: n/a
thanks for your valuable help .. ctypes is not lost for ever ..I'm
going to explore a little bit .. it may suit my need in the end ..
I had read :

http://www.python.org/dev/doc/devel/ext/intro.html

and eveything looked so simple in it ..
I'm sad to realize that it only works for linux plateform :(

I've tried to build and install ctypes from sources

I ran the following command:
python setup.py build
and I got the following message:
error: Python was built with version 6 of Visual Studio, and

extensions need to
be built with the same version of the compiler, but it isn't installed.
:( :( :( :( So sad ....
Jul 18 '05 #9

P: n/a
Diez B. Roggisch a écrit :
The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I
don't even have a python shell to perform the setup)

I'm sure it is possible to use dll-built with it ..
So please .. can you tell me where I can find Py_BuildValue and
Py_InitModule4 to link with ?

I doubt that adding new modules as dlls is easier than incorporating
pure-python ones or a mixture of both - as ctypes most probably is. After
all, its pythons module loading mechanism that kicks in for all cases.

If ctypes suits your needs outside of blender, I'd go for trying to
incorporate it into the blender interpreter.

I've tried to build and install ctypes from sources

I ran the following command:
python setup.py build
and I got the following message:
error: Python was built with version 6 of Visual Studio, and

extensions need to
be built with the same version of the compiler, but it isn't installed.
:( :( :( :( So sad ....

Jul 18 '05 #10

P: n/a
Thomas Heller a écrit :
Jean-Baptiste PERIN <jb******@yahoo.fr> writes:

Grant Edwards a écrit :

On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
>>I'm trying to make a windows dll reachable from a python script..
>
>FWIW, you can call dll's using the ctypes modules without
>mucking around in C. There may be performance reasons to build
>a "real" python module, but I haven't run across them yet.

Not really a performance reason .. but mainly because I have a
huge code produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C
code ..(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help?

It lets you easily call functions in DLLs.
Do you have a link to quickly learn about it ?

http://starship.python.net/crew/theller/ctypes/
http://starship.python.net/crew/thel.../tutorial.html
The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html

I think that is unrelated.


OK .. ctypes looks great .. and I plan to use it for futur purposes

The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I
don't even have a python shell to perform the setup)

You could try to download the ctypes windows installer, use winzip or
equivalent to unpack the contained files (you need _ctypes.pyd, and the
ctypes directory containing __init__.py), and copy them to some
directory where python can find them.

Thomas


I took a look at the ctypes tutorial .. Here's what I saw ..
from ctypes import *
printf = cdll.msvcrt.printf
printf.argtypes = [c_char_p, c_char_p, c_int, c_double]
printf("String '%s', Int %d, Double %f\n", "Hi", 10, 2.2)

just to perfom a printf !!!

now look at http://www.python.org/dev/doc/devel/ext/intro.html

and look at the expected result .. it is far simpler from the python
side view

I think ctype is uselful when dealing with dll you're not the author of

But if noone can help me to extend python with my own dll .. I going to
explore ctypes .. but I find it's bothering .. and frustrating not to
achieve what I wanted to do ..

Moreover .. I tried to build and install ctypes from source ..
I ran the command
python setup.py build
and I got the following message:
error: Python was built with version 6 of Visual Studio, and

extensions need to
be built with the same version of the compiler, but it isn't installed.
SO SAD :( :( :(
Jul 18 '05 #11

P: n/a
> and look at the expected result .. it is far simpler from the python
side view
But you have to do all the C-Work!

I think ctype is uselful when dealing with dll you're not the author of


It is useful, if you don't want to write an extension for the extra work
that is needed for that - for example if you are missing a C compiler.
>> error: Python was built with version 6 of Visual Studio, and

extensions need to
be built with the same version of the compiler, but it isn't installed.


How do you expect to be able to write your own extension if you don't have
the environment to do so in the first place? that error has nothing to do
with python itself, but with you not having installed the right compiler.
THe same problem will arise building your own extension.

Others suggested trying the ctypes binary installer. Do so.
--
Regards,

Diez B. Roggisch
Jul 18 '05 #12

P: n/a
Jean-Baptiste PERIN wrote:
Hi,

I'm trying to make a windows dll reachable from a python script .. and
I'm encountering troubles during link step ..

I use "lcc" to compile and link
I use python 2.3 under win XP


Note that MinGW32 is a tested path for building (free) C extensions. I
don't know if anyone has a tested way of using lcc.

With MinGW32, your build step will be the delightfully easy:

python setup.py build --compiler=mingw32

--Scott David Daniels
Sc***********@Acm.Org
Jul 18 '05 #13

P: n/a
>> error: Python was built with version 6 of Visual Studio, andextensions need to
be built with the same version of the compiler, but it isn't installed.

How do you expect to be able to write your own extension if you don't have
the environment to do so in the first place? that error has nothing to do
with python itself, but with you not having installed the right compiler.
THe same problem will arise building your own extension.


I know it has nothing to do with python ..
It just makes me sad to see that python cannot get rid of Visual Studoi
to be extended . It's just amazing !!

Python is free
The compiler I use is free
The code I plan to produce will be free

Where can I find a free version of Visual Studio ?

the only thing I use that is not free is the operating system and it's
because I had no choice .. my company decided for it
Others suggested trying the ctypes binary installer. Do so.


Yes .. that's what I'm going to do .. but I find it frustrating ..
Jul 18 '05 #14

P: n/a
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:
I know it has nothing to do with python ..
It just makes me sad to see that python cannot get rid of Visual Studoi
to be extended.


That's got nothing to do with Python. You have to compile
extensions using a compiler that has an ABI that's compatible
with the ABI of the compiler used to compile Python.

You appear to be using a binary distribution of Python that was
compiled with MSVS 6.0, therefore, you have to compile
extensions with a compiler that has an ABI compatible with MSVS
6.0.

It's no use complaining to us bout your C compiler not being
ABI compatible with MSVS 6.0.

If you don't like MSVS, then your options are to either use a
different Python binary distro that was compiled with an ABI
that's compatible with your C compiler, or build just build it
yourself using whatever compiler you want. I suspect the latter
will also require re-compiling Blender.

--
Grant Edwards grante Yow! Yow! Are we in the
at perfect mood?
visi.com
Jul 18 '05 #15

P: n/a
Jean-Baptiste PERIN wrote:
>> error: Python was built with version 6 of Visual Studio, and
extensions need to
be built with the same version of the compiler, but it isn't installed.


How do you expect to be able to write your own extension if you don't
have
the environment to do so in the first place? that error has nothing to do
with python itself, but with you not having installed the right compiler.
THe same problem will arise building your own extension.

I know it has nothing to do with python ..
It just makes me sad to see that python cannot get rid of Visual Studoi
to be extended . It's just amazing !!

Python is free
The compiler I use is free
The code I plan to produce will be free

Where can I find a free version of Visual Studio ?

the only thing I use that is not free is the operating system and it's
because I had no choice .. my company decided for it
Others suggested trying the ctypes binary installer. Do so.

Yes .. that's what I'm going to do .. but I find it frustrating ..


Perhaps you aren't aware that Microsoft make a free tool chain available
that can be used to create binary extensions? There has been some
discussion of this recently, and I managed to compile MySQLdb and a
couple of the mx extensions, so it's eminently doable [the PIL is
proving a little less tractable due to dependencies on other libraries
that I have yet to resolve].

The downloads are quite large, but if you want to try it, take a look at

http://www.vrplumber.com/programming/mstoolkit/

regards
Steve
--
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
Holden Web LLC +1 703 861 4237 +1 800 494 3119
Jul 18 '05 #16

P: n/a

First, you might check the calldll module available here

<http://www.nightmare.com/software.html>

Take a look at Pyrex, it may fit your requirements to access C from
Python.

<http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/>

If you do not have these already, you may need the Win32 API extension

<http://www.python.org/windows/win32/>
/Jean Brouwers

In article <cq**********@s5.feed.news.oleane.net>, Jean-Baptiste PERIN
<jb******@yahoo.fr> wrote:
Grant Edwards a écrit :
On 2004-12-20, Jean-Baptiste PERIN <jb******@yahoo.fr> wrote:

I'm trying to make a windows dll reachable from a python script..

FWIW, you can call dll's using the ctypes modules without
mucking around in C. There may be performance reasons to build
a "real" python module, but I haven't run across them yet.


Not really a performance reason .. but mainly because I have a huge code
produced in C and no time to port it in python ..
Moreover .. I need the python program to interact with the C code
..(perfom calls to dll-defined functions)

I don't know ctypes module .. do you really think it can help ?
Do you have a link to quickly learn about it ?

The only thing I found is :
http://www.python.org/workshops/1994...Classes_5.html


Jul 18 '05 #17

P: n/a

Jean-Baptiste PERIN wrote:
Hi,

I'm trying to make a windows dll reachable from a python script .. and I'm encountering troubles during link step ..

I use "lcc" to compile and link
I use python 2.3 under win XP [snip] Here are the errors :
---------------------
Error c:\...\plugins\hello.c 14 undefined reference to __imp__Py_BuildValue Error c:\...\plugins\hello.c 46 undefined reference to __imp__Py_InitModule4
[snip] return Py_BuildValue("i", 1); [snip] void __declspec(dllexport) inithello()
{
(void)Py_InitModule3("hello", helloMethods, MHello__doc__);
Can anyone help me?


Yes. Option 1: *Maybe* you can help yourself. Have you not noticed from
the above that the compiler is magically prepending "__imp__" to the
names of external functions? However the .lib that comes with Python
won't have that "__imp__". You would have to bridge that gap, somehow.
Have you searched the lcc documentation? Are you prepared for the next
several problems that may arise?

By the way, lcc also *appears* to change "...Module3" to "...Module4"
:-)

Option 2: You have been helped already. There are two free compilers
which work quite well for developing extensions in C for win32
platforms; start reading here:

http://docs.python.org/inst/tweak-fl...00000000000000

Jul 18 '05 #18

P: n/a
John Machin wrote:
By the way, lcc also *appears* to change "...Module3" to "...Module4" :-)


$ more Include/modsupport.h

....

#define Py_InitModule3(name, methods, doc) \
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)

....

</F>

Jul 18 '05 #19

P: n/a

That's got nothing to do with Python. You have to compile
extensions using a compiler that has an ABI that's compatible
with the ABI of the compiler used to compile Python.

You appear to be using a binary distribution of Python that was
compiled with MSVS 6.0, therefore, you have to compile
extensions with a compiler that has an ABI compatible with MSVS
6.0.

It's no use complaining to us bout your C compiler not being
ABI compatible with MSVS 6.0.

If you don't like MSVS, then your options are to either use a
different Python binary distro that was compiled with an ABI
that's compatible with your C compiler, or build just build it
yourself using whatever compiler you want. I suspect the latter
will also require re-compiling Blender.


According to what I read in this forum, MinGW is an interesting option..
do you know if it is ABI compatible with MSVC?

otherwise.. I'm gonna explore the solution which consist in building the
dll with cygwin's gcc .. I've already recompiled Blender with gcc .. I
know that, in Blender code, there are C++ function that are available
from Blender's python ..
I've started exploring the makefile.. apparently they are using dlltool
in conjonction with gcc ..

thank you very much for your help ..

Jul 18 '05 #20

P: n/a
Steve Holden a écrit :
Jean-Baptiste PERIN wrote:

>> error: Python was built with version 6 of Visual Studio, and
extensions need to
be built with the same version of the compiler, but it isn't installed.


How do you expect to be able to write your own extension if you don't
have
the environment to do so in the first place? that error has nothing
to do
with python itself, but with you not having installed the right
compiler.
THe same problem will arise building your own extension.


I know it has nothing to do with python ..
It just makes me sad to see that python cannot get rid of Visual
Studoi to be extended . It's just amazing !!

Python is free
The compiler I use is free
The code I plan to produce will be free

Where can I find a free version of Visual Studio ?

the only thing I use that is not free is the operating system and it's
because I had no choice .. my company decided for it
Others suggested trying the ctypes binary installer. Do so.


Yes .. that's what I'm going to do .. but I find it frustrating ..

Perhaps you aren't aware that Microsoft make a free tool chain available
that can be used to create binary extensions? There has been some
discussion of this recently, and I managed to compile MySQLdb and a
couple of the mx extensions, so it's eminently doable [the PIL is
proving a little less tractable due to dependencies on other libraries
that I have yet to resolve].

The downloads are quite large, but if you want to try it, take a look at

http://www.vrplumber.com/programming/mstoolkit/

regards
Steve

If nothing else works .. I'll try that way ..
So far, I've tried to keep as far as possible from MS things ..

thank you for your help ...

Jul 18 '05 #21

P: n/a
Jean Brouwers a écrit :
First, you might check the calldll module available here

<http://www.nightmare.com/software.html>
I have one or two things to try before ..but it looks interesting ..
thank you very much ..
Take a look at Pyrex, it may fit your requirements to access C from
Python.

<http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex/>
Yes, pirex looks very powerful ..I heard about it already .. I know
someone who used it .. and the result was just amazing ..
there's also SWIG which looks very sexy
http://www.swig.org/tutorial.html

My current problem is a compilation one .. I need to first solve it
before exploring these tools ..

If you do not have these already, you may need the Win32 API extension

<http://www.python.org/windows/win32/>
/Jean Brouwers

Thank you very much Jean
Jul 18 '05 #22

P: n/a
Note that MinGW32 is a tested path for building (free) C extensions. I
don't know if anyone has a tested way of using lcc.
Yes, very interesting
I can already conclude that either I don't know how to use lcc
or it doesn't suit my needs ..
in both case I have to quickly get rid of it .. before I throw the
computer through the window ..

I plan to first test the cygwin's gcc compiler before goign to MinGW32
With MinGW32, your build step will be the delightfully easy:

python setup.py build --compiler=mingw32

Thank you very much for your help
Jul 18 '05 #23

P: n/a
John Machin a écrit :
Jean-Baptiste PERIN wrote:
Hi,

I'm trying to make a windows dll reachable from a python script ..
and
I'm encountering troubles during link step ..

I use "lcc" to compile and link
I use python 2.3 under win XP


[snip]
Here are the errors :
---------------------
Error c:\...\plugins\hello.c 14 undefined reference to


__imp__Py_BuildValue
Error c:\...\plugins\hello.c 46 undefined reference to


__imp__Py_InitModule4
[snip]
return Py_BuildValue("i", 1);


[snip]
void __declspec(dllexport) inithello()
{
(void)Py_InitModule3("hello", helloMethods, MHello__doc__);
Can anyone help me?

Yes. Option 1: *Maybe* you can help yourself. Have you not noticed from
the above that the compiler is magically prepending "__imp__" to the
names of external functions? However the .lib that comes with Python
won't have that "__imp__". You would have to bridge that gap, somehow.
Have you searched the lcc documentation? Are you prepared for the next
several problems that may arise?


Indeed, it's something I can't understand (the __imp__ stuff)..
Nothing appear about that in the
I have posted a question on lcc forum .. the author of lcc answered

"This happens because somewhere you are declaring the functions
Py_BuildValue
and
Py_InitModule

as __declspec(dllimport) "

He's right !!
He adviced me to change that ..
I don't want to make changes to python code .. so .. bye bye lcc

long life to gcc
By the way, lcc also *appears* to change "...Module3" to "...Module4"
:-)
this one is explainable to me .. it is due to the fact that both
function are equivalent

in mod support.h:

#define Py_InitModule3(name, methods, doc) \
Py_InitModule4(name, methods, doc, (PyObject *)NULL, \
PYTHON_API_VERSION)

Option 2: You have been helped already. There are two free compilers
which work quite well for developing extensions in C for win32
platforms; start reading here:

http://docs.python.org/inst/tweak-fl...00000000000000


I'm currently attracted by the cygwin solution .. that I find very sexy !!
If I fail .. I will explore the MingW ..

Thank you very much for helping me ..
Jul 18 '05 #24

P: n/a
Jean-Baptiste PERIN wrote:
I can already conclude that either I don't know how to use lcc
or it doesn't suit my needs ..
I plan to first test the cygwin's gcc compiler before goign to MinGW32


MinGW32 is "Minimalist Gnu for Windows -- 32-bit," and _works_ at
being ABI compatible with Microsoft's ABI and its C runtime. Cygwin
is a way of building a *nix-compatible toolset _on_ Windows, not _in_
windows. What that means (as far as I understand the issues) is that
you'll need to build a Cygwin python in order to use Cygwin modules.
I put in a bit of effort to make sure Python could build for that
compiler (not by MinGW-specific code, but by cleaning up an issue in
the CPython header file for non-MS compilers). There are toolchain
issues to consider (not just the compiler itself, , but function call
conventions, global access, linker/loader, and debugger symbols and
access are involved).

Python 2.4's jump to a new C compiler on windows is a well-justified
decision (Windows C/C++ 6.0's stuff is getting long in the tooth), but
short-term disruptive to small-time Python C module development. The
change does not portend a continuous series of compiler-jumps, but
rather a hope to not become hopelessly mired in ancient history. It
is getting hard (or is impossible, I don't know which) to purchase
Windows C/C++ 6.0 for money these days, and this will only get harder.

In short, I urge you to go with MinGW if you are hoping to write for
windows with a GNU compiler; you'll be swimming upstream a bit less.

--Scott David Daniels
Sc***********@Acm.Org
Jul 18 '05 #25

This discussion thread is closed

Replies have been disabled for this discussion.