Ref: http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00137.html

I am trying to build the 64bit Python (2.7.3 and 3.3) bindings for
libftdi1-1.0 ( http://www.intra2net.com/en/developer/libftdi/download.php )
with MinGW-w64 (Ruben personal build 4.7.2 release).
But somehow it does not work.

I am trying using the instructions here.
http://stackoverflow.com/questions/11182765/how-can-i-build-my-c-extensions-with-mingw-w64-in-python

For 64bit Python 2.7.3, I did the following.
1) gendef.exe python27.dll
2) dlltool.exe --dllname python27.dll --def python27.def --output-lib
libpython27.a
3) Copy libpython27.a to C:\Python27\libs

Strangely, gendef has already used Py_InitModule4_64 but I need
to rename it back to Py_InitModule4 to get the Python binding build
successfully.

But the resultant Python bindings do not work. Just FYI,
32bit Python binding works very well but I do not need
to use gendef and dlltool there since the default 32bit
Python windows binaries already provide the import
library libpython27.a.

c:\work\libftdi\libftdi1-1.0\examples\python>python
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ftdi1 as ftdi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python27\lib\site-packages\ftdi1.py", line 30, in <module>
    _ftdi1 = swig_import_helper()
  File "C:\python27\lib\site-packages\ftdi1.py", line 26, in swig_import_helper
    _mod = imp.load_module('_ftdi1', fp, pathname, description)
ImportError: DLL load failed: The specified procedure could not be found.

For 64bit Python 3.3, I did the following.
1) gendef.exe python33.dll
2) dlltool.exe --dllname python33.dll --def python33.def --output-lib
libpython33.a
3) Copy libpython33.a to C:\Python33\libs

Then I do not need to modify python33.def and everything builds fine.
However, again the resultant Python bindings do not work. When
I tried to load the ftdi1 module, Python 3.3 (64bit) crashed and
says ""Python.exe has stopped working".

Just wondering what I did wrong. Or it is a problem with
64bit Python and MinGW-w64.

If you want to try to build libftdi1-1.0, here is a simple
instruction. Just use MinGW-w64/MSys and not
MinGW.org/MSys for the 64bit build.
http://developer.intra2net.com/mailarchive/html/libftdi/2013/msg00132.html

-- 
Xiaofan

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to