Quantcast

windows 7 Python modules

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

windows 7 Python modules

Joachim Schambach
I have written a Python module ("extension") in Linux using code that calls
libftdi functions and successfully built it using the Python setup tools. Now I
am trying to port this to a Windows 7 machine, but am a little lost on how to
best go about this. A first attempt on compiling the same module under the
ActivePython distribution in Windows seems to want to use Microsoft Visual
Studio as the compiler. I did not see any version of libftdi compiled for that,
so do I first need to figure out how to compile the library itself under Windows
or is there a precompiled binary somewhere? I assume somehow I will also need
libusb for windows, so how do I go about that?
sorry if these are some very basic questions, but I couldn't find any writeup on
how to best go about this. The README only seems to indicate using mingw, but I
don't know how to combine this with the Python distribution under Windows.
Any help would be greatly appreciated.
Cheers,
Jo

--
Dr Joachim Schambach                 tel: +1 512 471 1303
The University of Texas at Austin    fax: +1 512 471 9637    
Department of Physics                email1: [hidden email]
1 University Station C1600     email2: [hidden email]
Austin, Texas 78712-0264, USA


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Thu, Oct 23, 2014 at 10:05 PM, Joachim Schambach
<[hidden email]> wrote:

> I have written a Python module ("extension") in Linux using code that calls
> libftdi functions and successfully built it using the Python setup tools. Now I
> am trying to port this to a Windows 7 machine, but am a little lost on how to
> best go about this. A first attempt on compiling the same module under the
> ActivePython distribution in Windows seems to want to use Microsoft Visual
> Studio as the compiler. I did not see any version of libftdi compiled for that,
> so do I first need to figure out how to compile the library itself under Windows
> or is there a precompiled binary somewhere? I assume somehow I will also need
> libusb for windows, so how do I go about that?
> sorry if these are some very basic questions, but I couldn't find any writeup on
> how to best go about this. The README only seems to indicate using mingw, but I
> don't know how to combine this with the Python distribution under Windows.
> Any help would be greatly appreciated.
> Cheers,
> Jo

I have compiled libftdi using MinGW (both 32bit MinGW.org and the 32/64bit
MinGW-w64 toolchain) under Windows.

http://sourceforge.net/projects/picusb/files/

On the other hand, I do not use Active Python but rather the
Python.org vanilla Python. I remembered that I have some
challenges getting 64bit Python 2.7 to work with MinGW-w64.

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: windows 7 Python modules

Michel Zou
Hi,

You dont have to deal with the hassle of visual studio crap, you can cross-compile libftdi and it's python module using mingw,
it then can be loaded in the native python interpreter and any other even if the interpreter itself is compiled with msvc.
You'll have to provide libftdi & libusb mingw dlls (and of course libftdi's pyd) along the module.

This will be interesting to you:
https://aur.archlinux.org/packages/mingw-w64-libusb/
https://aur.archlinux.org/packages/mingw-w64-libftdi/

xan.

> Date: Fri, 24 Oct 2014 09:52:40 +0800

> Subject: Re: windows 7 Python modules
> From: [hidden email]
> To: [hidden email]
>
> On Thu, Oct 23, 2014 at 10:05 PM, Joachim Schambach
> <[hidden email]> wrote:
> > I have written a Python module ("extension") in Linux using code that calls
> > libftdi functions and successfully built it using the Python setup tools. Now I
> > am trying to port this to a Windows 7 machine, but am a little lost on how to
> > best go about this. A first attempt on compiling the same module under the
> > ActivePython distribution in Windows seems to want to use Microsoft Visual
> > Studio as the compiler. I did not see any version of libftdi compiled for that,
> > so do I first need to figure out how to compile the library itself under Windows
> > or is there a precompiled binary somewhere? I assume somehow I will also need
> > libusb for windows, so how do I go about that?
> > sorry if these are some very basic questions, but I couldn't find any writeup on
> > how to best go about this. The README only seems to indicate using mingw, but I
> > don't know how to combine this with the Python distribution under Windows.
> > Any help would be greatly appreciated.
> > Cheers,
> > Jo
>
> I have compiled libftdi using MinGW (both 32bit MinGW.org and the 32/64bit
> MinGW-w64 toolchain) under Windows.
>
> http://sourceforge.net/projects/picusb/files/
>
> On the other hand, I do not use Active Python but rather the
> Python.org vanilla Python. I remembered that I have some
> challenges getting 64bit Python 2.7 to work with MinGW-w64.
>
> --
> Xiaofan
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]
>


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Fri, Oct 24, 2014 at 2:48 PM, xantares 09 <[hidden email]> wrote:
> Hi,
>
> You dont have to deal with the hassle of visual studio crap, you can
> cross-compile libftdi and it's python module using mingw,

It is easy to cross-compile libftdi's library (static and dynamic) using
MinGW. How do you do that for the Python binding side?

> it then can be loaded in the native python interpreter and any other even if
> the interpreter itself is compiled with msvc.
> You'll have to provide libftdi & libusb mingw dlls (and of course libftdi's
> pyd) along the module.

What do you mean by libftdi's pyd?

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: windows 7 Python modules

Michel Zou


> Date: Fri, 24 Oct 2014 15:25:54 +0800

> Subject: Re: windows 7 Python modules
> From: [hidden email]
> To: [hidden email]
>
> On Fri, Oct 24, 2014 at 2:48 PM, xantares 09 <[hidden email]> wrote:
> > Hi,
> >
> > You dont have to deal with the hassle of visual studio crap, you can
> > cross-compile libftdi and it's python module using mingw,
>
> It is easy to cross-compile libftdi's library (static and dynamic) using
> MinGW. How do you do that for the Python binding side?
It's simple: we kill the batman.
Or you just link against native python lib.

> > it then can be loaded in the native python interpreter and any other even if
> > the interpreter itself is compiled with msvc.
> > You'll have to provide libftdi & libusb mingw dlls (and of course libftdi's
> > pyd) along the module.
>
> What do you mean by libftdi's pyd?
On windows compiled python extensions have the suffix .pyd
>
> --
> Xiaofan
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]
>


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Fri, Oct 24, 2014 at 4:52 PM, xantares 09 <[hidden email]> wrote:
>> > You dont have to deal with the hassle of visual studio crap, you can
>> > cross-compile libftdi and it's python module using mingw,
>>
>> It is easy to cross-compile libftdi's library (static and dynamic) using
>> MinGW. How do you do that for the Python binding side?
>
> It's simple: we kill the batman.
> Or you just link against native python lib.

Where do you get the native python lib under Linux? Or you
just copy the Windows Python installation to Linux?

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Fri, Oct 24, 2014 at 9:51 PM, Xiaofan Chen <[hidden email]> wrote:

> On Fri, Oct 24, 2014 at 4:52 PM, xantares 09 <[hidden email]> wrote:
>>> > You dont have to deal with the hassle of visual studio crap, you can
>>> > cross-compile libftdi and it's python module using mingw,
>>>
>>> It is easy to cross-compile libftdi's library (static and dynamic) using
>>> MinGW. How do you do that for the Python binding side?
>>
>> It's simple: we kill the batman.
>> Or you just link against native python lib.
>
> Where do you get the native python lib under Linux? Or you
> just copy the Windows Python installation to Linux?
>

Ah I see, you are using Arch Linux and there is AUR packages
for MinGW-w64 Python.
https://aur.archlinux.org/packages/?K=mingw-w64-python

I am using Mac OS X and Ubuntu Linux and there does not seem
to have very good cross compile infrastructure there. Fedora and
Arch seem to be good in this aspect.

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Joachim Schambach
In reply to this post by Michel Zou
OK, thanks for all the responses.
I tried around a little, but i think i am still missing something very fundamental in the MinGW setup or something like that.
So let me try to be a little more specific:

The module that works just fine under Linux is called ftdIOmodule.c, which in turn calls all kinds of functions from libftdi. I tried to modify the "setup.py" file to correspond to the appropriate Windows files, and came up with something like this:

---- setup.py -----
from distutils.core import setup, Extension
 
module1 = Extension('ftdIO',
                    include_dirs = ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/include/libftdi1'],
                    libraries = ['ftdi1'],
                    library_dirs = ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/lib64'],
                    define_macros=[('MS_WIN64', 1)],
                    sources = ['ftdIOmodule.c'])
 
setup (name = 'PackageName',
        version = '1.1',
        description = 'ftdIO functions for Python',
        ext_modules = [module1])
---- end setup.py ---------

I then tried to compile this with the command line:

python setup_windows.py build -c mingw32

and that's when I saw all kinds of error messages:

running build
running build_ext
building 'ftdIO' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64=1 -I../../../FTDI_USB/libftdi1-1.
1_devkit_x86_x64_21Feb2014/include/libftdi1 -IC:\Python27\include -IC:\Python27\
PC -c ftdIOmodule.c -o build\temp.win-amd64-2.7\Release\ftdiomodule.o
ftdIOmodule.c: In function 'writeMemFromFile':
ftdIOmodule.c:153:3: warning: implicit declaration of function 'getline' [-Wimpl
icit-function-declaration]
   if((bytes_read = getline(&line, &nbytes, fr)) > 0) {
   ^
writing build\temp.win-amd64-2.7\Release\ftdIO.def
creating build\lib.win-amd64-2.7
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-2.7\Release\ftdiomodule.o build\temp.win-amd64-2.7\Release\ftdIO.def -L../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/lib64 -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -lftdi1 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\ftdIO.pyd
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x32): undefined reference to `_imp__Py_InitModule4_64'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x43): undefined reference to `ftdi_new'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x71): undefined reference to `ftdi_usb_open_desc'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x91): undefined reference to `ftdi_set_bitmode'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0xa9): undefined reference to `ftdi_set_latency_timer'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0xd5): undefined reference to `_imp__PyArg_ParseTuple'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0xf3): undefined reference to `_imp__PyExc_RuntimeError'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0xfe): undefined reference to `_imp__PyErr_SetString'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x146): undefined reference to `_imp__PyExc_NameError'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x151): undefined reference to `_imp__PyErr_SetString'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x15d): undefined reference to `_imp___Py_NoneStruct'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x186): undefined reference to `ftdi_usb_close'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x196): undefined reference to `ftdi_free'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x1eb): undefined reference to `_imp__PyArg_ParseTuple'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x22d): undefined reference to `_imp__PyExc_RuntimeError'
build\temp.win-amd64-2.7\Release\ftdiomodule.o:ftdIOmodule.c:(.text+0x238): undefined reference to `_imp__PyErr_SetString'
....

and so on
I kind of understand the warning about the getline function, but it looks like none of the "Python" or "libftdi" functions are found by gcc in the libraries you provided?

So what am I missing? Since Python is probably compiled by MS Visual Studio, maybe that explains all the missing symbols from Python.

Very puzzled,

Jo

On 10/24/2014 1:48 AM, xantares 09 wrote:
Hi,

You dont have to deal with the hassle of visual studio crap, you can cross-compile libftdi and it's python module using mingw,
it then can be loaded in the native python interpreter and any other even if the interpreter itself is compiled with msvc.
You'll have to provide libftdi & libusb mingw dlls (and of course libftdi's pyd) along the module.

This will be interesting to you:
https://aur.archlinux.org/packages/mingw-w64-libusb/
https://aur.archlinux.org/packages/mingw-w64-libftdi/

xan.

> Date: Fri, 24 Oct 2014 09:52:40 +0800
> Subject: Re: windows 7 Python modules
> From: [hidden email]
> To: [hidden email]
>
> On Thu, Oct 23, 2014 at 10:05 PM, Joachim Schambach
> [hidden email] wrote:
> > I have written a Python module ("extension") in Linux using code that calls
> > libftdi functions and successfully built it using the Python setup tools. Now I
> > am trying to port this to a Windows 7 machine, but am a little lost on how to
> > best go about this. A first attempt on compiling the same module under the
> > ActivePython distribution in Windows seems to want to use Microsoft Visual
> > Studio as the compiler. I did not see any version of libftdi compiled for that,
> > so do I first need to figure out how to compile the library itself under Windows
> > or is there a precompiled binary somewhere? I assume somehow I will also need
> > libusb for windows, so how do I go about that?
> > sorry if these are some very basic questions, but I couldn't find any writeup on
> > how to best go about this. The README only seems to indicate using mingw, but I
> > don't know how to combine this with the Python distribution under Windows.
> > Any help would be greatly appreciated.
> > Cheers,
> > Jo
>
> I have compiled libftdi using MinGW (both 32bit MinGW.org and the 32/64bit
> MinGW-w64 toolchain) under Windows.
>
> http://sourceforge.net/projects/picusb/files/
>
> On the other hand, I do not use Active Python but rather the
> Python.org vanilla Python. I remembered that I have some
> challenges getting 64bit Python 2.7 to work with MinGW-w64.
>
> --
> Xiaofan
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]
>


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]



-- 
Dr Joachim Schambach                 tel: +1 512 471 1303
The University of Texas at Austin    fax: +1 512 471 9637    
Department of Physics                email1: [hidden email]
1 University Station C1600	     email2: [hidden email]
Austin, Texas 78712-0264, USA


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Fri, Oct 24, 2014 at 11:54 PM, Joachim Schambach
<[hidden email]> wrote:

> OK, thanks for all the responses.
> I tried around a little, but i think i am still missing something very
> fundamental in the MinGW setup or something like that.
> So let me try to be a little more specific:
>
> The module that works just fine under Linux is called ftdIOmodule.c, which
> in turn calls all kinds of functions from libftdi. I tried to modify the
> "setup.py" file to correspond to the appropriate Windows files, and came up
> with something like this:
>
> ---- setup.py -----
> from distutils.core import setup, Extension
>
> module1 = Extension('ftdIO',
>                     include_dirs =
> ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/include/libftdi1'],
>                     libraries = ['ftdi1'],
>                     library_dirs =
> ['../../../FTDI_USB/libftdi1-1.1_devkit_x86_x64_21Feb2014/lib64'],
>                     define_macros=[('MS_WIN64', 1)],
>                     sources = ['ftdIOmodule.c'])
>
> setup (name = 'PackageName',
>         version = '1.1',
>         description = 'ftdIO functions for Python',
>         ext_modules = [module1])
> ---- end setup.py ---------

Sorry I do not know Python well enough to comment on
the above.

> I then tried to compile this with the command line:
>
> python setup_windows.py build -c mingw32
>

First thing first, are you using 64bit Python or 32bit Python? Are
you using MinGW.org 32bit toolchain or the MinGW-w64 toolchain?

If you use Python 2.7, try to stick to the 32bit version, I have
quite some problem to get Python 2.7 64bit to work to build
libftdi Python binding.

And then you need to use 32bit tool chain. If you use MinGW.org,
then you need to use libftdi1-1.1_devkit_mingw32_12Feb2014.zip
which was built using MinGW.org 32bit toolchain.

If you use MinGW-w64 (usually the one shipped in modern Linux),
then you need to use libftdi1-1.1_devkit_x86_x64_21Feb2014.zip.
Inside there is both 32bit and 64bit libraries. You'd better use
32bit Python 2.7 and the 32bit MinGW-w64 toolchain.

BTW, why do you need to build your own Python bindings?


--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Sat, Oct 25, 2014 at 8:11 AM, Xiaofan Chen <[hidden email]> wrote:
> BTW, why do you need to build your own Python bindings?
>

I ask because there are already a few Python bindings for FTDI, other
than libftdi's Python binding, there are also a few others.

Eg:
https://pypi.python.org/pypi/pyftdi/0.9.6
https://pypi.python.org/pypi/pylibftdi/0.14.2

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Joachim Schambach
I have invented my own protocol to communicate with an FPGA based board
we designed that uses an FTDI chip to provide USB  access. This protocol
includes functions like readRegister, writeRegister, readMemory,
writeMemory, etc.
I have a C++ library that provides these functions to the command line,
or to a (C++) application program.
At some point, we decided it would be nice to have scripting capability
for these functions and decided on Python to provide this. It was easy
to convert the library into a Python "extension" module under Linux and
compile it.
Now one of our users wants to do the scripting in Windows, so I am
trying to simply compile the same module under Windows.
From the libftdi web the claim is that it works under Windows, so I
thought it would be easy to port this module, which I am now finding is
a little more work than I thought. I didn't want to have to re-write the
whole protocol in Python again (having to try to figure out how to do
that), but rather just provide the final "user" function in Python, thus
the idea to compile the protocol as a module...
cheers,
Jo

On 10/24/2014 7:17 PM, Xiaofan Chen wrote:

> On Sat, Oct 25, 2014 at 8:11 AM, Xiaofan Chen <[hidden email]> wrote:
>> BTW, why do you need to build your own Python bindings?
>>
> I ask because there are already a few Python bindings for FTDI, other
> than libftdi's Python binding, there are also a few others.
>
> Eg:
> https://pypi.python.org/pypi/pyftdi/0.9.6
> https://pypi.python.org/pypi/pylibftdi/0.14.2
>

--
Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station #C1600
Austin, Texas 78712-0264, USA
(512) 471-1303, FAX: (781) 998-5513
email: [hidden email]


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Sun, Oct 26, 2014 at 12:45 AM, Joachim Schambach
<[hidden email]> wrote:

> I have invented my own protocol to communicate with an FPGA based board
> we designed that uses an FTDI chip to provide USB  access. This protocol
> includes functions like readRegister, writeRegister, readMemory,
> writeMemory, etc.
> I have a C++ library that provides these functions to the command line,
> or to a (C++) application program.
> At some point, we decided it would be nice to have scripting capability
> for these functions and decided on Python to provide this. It was easy
> to convert the library into a Python "extension" module under Linux and
> compile it.
> Now one of our users wants to do the scripting in Windows, so I am
> trying to simply compile the same module under Windows.
> From the libftdi web the claim is that it works under Windows, so I
> thought it would be easy to port this module, which I am now finding is
> a little more work than I thought. I didn't want to have to re-write the
> whole protocol in Python again (having to try to figure out how to do
> that), but rather just provide the final "user" function in Python, thus
> the idea to compile the protocol as a module...
> cheers,

I see. It should work. I think you can try the 32bit Python first with
MinGW.org or MinGW-w64 32bit toolchain to see if that works.
32bit Python 2.7 has an import library named libpython27.a for MinGW.

Forget about 64bit Python 2.7 for a while, there Python did not
provide the import library for MinGW and there is more trouble
there.
Ref: http://sourceforge.net/p/mingw-w64/mailman/message/30503023/


--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: windows 7 Python modules

Michel Zou


> Date: Sun, 26 Oct 2014 10:54:24 +0800

> Subject: Re: windows 7 Python modules
> From: [hidden email]
> To: [hidden email]
>
> On Sun, Oct 26, 2014 at 12:45 AM, Joachim Schambach
> <[hidden email]> wrote:
> > I have invented my own protocol to communicate with an FPGA based board
> > we designed that uses an FTDI chip to provide USB access. This protocol
> > includes functions like readRegister, writeRegister, readMemory,
> > writeMemory, etc.
> > I have a C++ library that provides these functions to the command line,
> > or to a (C++) application program.
> > At some point, we decided it would be nice to have scripting capability
> > for these functions and decided on Python to provide this. It was easy
> > to convert the library into a Python "extension" module under Linux and
> > compile it.
> > Now one of our users wants to do the scripting in Windows, so I am
> > trying to simply compile the same module under Windows.
> > From the libftdi web the claim is that it works under Windows, so I
> > thought it would be easy to port this module, which I am now finding is
> > a little more work than I thought. I didn't want to have to re-write the
> > whole protocol in Python again (having to try to figure out how to do
> > that), but rather just provide the final "user" function in Python, thus
> > the idea to compile the protocol as a module...
> > cheers,
>
> I see. It should work. I think you can try the 32bit Python first with
> MinGW.org or MinGW-w64 32bit toolchain to see if that works.
> 32bit Python 2.7 has an import library named libpython27.a for MinGW.
>
> Forget about 64bit Python 2.7 for a while, there Python did not
> provide the import library for MinGW and there is more trouble
> there.
> Ref: http://sourceforge.net/p/mingw-w64/mailman/message/30503023/
no, you can rebuild the import lib with mingw-tools, i successfully built win64 python bindings for another project that uses swig.
>
> --
> Xiaofan
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]
>


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: windows 7 Python modules

Xiaofan Chen
On Sun, Oct 26, 2014 at 5:12 PM, xantares 09 <[hidden email]> wrote:

>> I see. It should work. I think you can try the 32bit Python first with
>> MinGW.org or MinGW-w64 32bit toolchain to see if that works.
>> 32bit Python 2.7 has an import library named libpython27.a for MinGW.
>>
>> Forget about 64bit Python 2.7 for a while, there Python did not
>> provide the import library for MinGW and there is more trouble
>> there.
>> Ref: http://sourceforge.net/p/mingw-w64/mailman/message/30503023/
>
> no, you can rebuild the import lib with mingw-tools, i successfully built
> win64 python bindings for another project that uses swig.
>

Actually I used gendef to rebuild the import lib for MinGW-w64 and
still I encountered issues similar to the OP. In the end, asking
in MinGW-w64 group helped me to sorted out the issue ( -DMS_WIN64).
It is documented in the mailing list archive of MinGW-w64.
   http://sourceforge.net/p/mingw-w64/mailman/message/30503023/

I am not an expert in Python. Maybe you can help the OP more
by giving him some examples.

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Loading...