基于mingw32 msys对libffi3.2.1在windows10 64位上编译成32位的dll,供使用:
1.下载libffi3.2.1 https://proj.goldencode.com/downloads/libffi/libffi_3.2.1_sources.zip
2.下载msys https://proj.goldencode.com/downloads/mingw/msys32_20111123.zip
3.mingw32自己百度
解压libffi,可以用jar xf libffi_3.2.1_sources.zip假设在c:\libffi-3.2.1
解压msys到合适的目录,这里假设为c:\msys,在此目录下点击msys.bat启动一个shell窗口
在shell窗口cd c:\libffi-3.2.1
32位上执行:sh ./configure
64位上执行:
sh ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
我的目标系统为32位,所以用sh ./configure
执行上一步后会在c:\libffi-3.2.1下根据平台生成Makefile
执行make
include文件目录下如:
Link库文件目录:
DLL运行时库目录下的libffi6.dll即是,把libfffi-6.dll放在c:\windows下:
编译示例(把上一步的dll放c:\windows下才能运行,否则只能编译成功,不能运行):
-I加双引号,一次只能有一个-I,如下:
-I不加双引号,可以多个-I