我遵循指導,我發現here。Matlab 2011b和mingw64
我已經差不多完成了這項工作。以下部分是批量轉換工作的段落。我已經創建了一個批處理文件,用於在Matlab 2011b Windows 7(64位)中轉換大量由MSVC預先構建的DLL。
set path=C:\MinGW64\bin;C:\mingw\msys\bin;
mkdir lib
mkdir bin
@echo y |copy *.dll .\bin
@echo y |copy *.lib .\lib
@echo EXPORTS >libmex.def
@echo EXPORTS >libmx.def
@echo EXPORTS >libmat.def
@echo EXPORTS >libeng.def
@echo EXPORTS >libmwlapack.def
c:\mingw64\bin\pexports ./bin/libmex.dll | sed "s/^_//" > libmex.def
c:\mingw64\bin\pexports ./bin/libmat.dll | sed "s/^_//" > libmat.def
c:\mingw64\bin\pexports ./bin/libeng.dll | sed "s/^_//" > libeng.def
c:\mingw64\bin\pexports ./bin/libmwlapack.dll | sed "s/^_//" >libmwlapack.def
gendef ./bin/libmx.dll
echo "Add the mexErrMsgTxt string to each def file,"
echo "then press any key to continue the conversion process"
pause
lib /machine:x64 /def:libmex.def /name:.\bin\libmex.dll /out:.\lib\libmex.lib
lib /machine:x64 /def:libmx.def /name:.\bin\libmx.dll /out:.\lib\libmx.lib
lib /machine:x64 /def:libmat.def /name:.\bin\libmat.dll /out:.\lib\libmat.lib
lib /machine:x64 /def:libeng.def /name:.\bin\libeng.dll /out:.\lib\libeng.lib
lib /machine:x64 /def:libmwlapack.def /name:.\bin\libmwlapack.dll /out:.\lib\libmwlapack.lib
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmex.def -l /lib/libmex.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmat.def -l ./lib/libmat.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libeng.def -l ./lib/libeng.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmx.def -l./lib/libmx.a
c:\mingw64\bin\x86_64-w64-mingw32-dlltool --kill-at -U -d libmwlapack.def -l ./lib/libmwlapack.a
生成文件爲engwindemo.exe:
LIBS= -Lc:/mingw64/lib ../lib/libeng.a ../lib/libmx.a ../lib/
libmex.a ../lib/libmat.a
CC=c:/mingw64/bin/gcc -m64 -O3 -I../include -Ic:/mingw64/include
EXE=../bin/engwindemo.exe
SRC=engwindemo.c
all:$(EXE)
$(EXE): $(SRC)
$(CC) $(SRC) $(LIBS) -L../lib -ladvapi32 -luser32 -lgdi32 -lkernel32 -
lmingwex -o $(EXE)
@rm -f *.o*
使用(mingw64)GCC,編譯和鏈接過程是確定。執行engwindemo.exe,我得到這個錯誤:
_engClose entry point error (in libeng.dll)
在mingw64,我怎麼能建立一個獨立的應用程序(engwindemo.exe)從函數的調用內置的libeng.dll(Matlab的R2011b) ?
請妥善格式化您的問題和澄清您的實際問題。 – Egon 2012-02-25 08:54:41
>我的問題是如何構建一個通過mingw64調用matlab 2011b(64位)引擎的獨立可執行文件?在上述過程中,出現了什麼問題 – 2012-02-25 11:18:24
是的,我按照附加的指導方針行事,有些事情我錯過了。 Mingw64可以生成從libeng.dll調用的獨立應用程序。事實上,它沒有運行。 – 2012-02-25 11:33:20