The matlab compiler is the mingw-w64 Add on.
To generate the dll, also system wide mingw-w64 installation is done.
I'm able to generate the mex funtion (at the end the toolchain is described)
After executing the file_mex, the dll is said not to be found, but the dll is in the current directory and in the windows's & matlab path.
'file_mex.mexw64': Missing dependent shared libraries:'file.dll' required by 'file_mex.mexw64'.
loading the dll with loadlibrary says that
'file_mex.dll' has different architecture than the host.
Note that loadlibrary finds file.dll without problems.
My compiling toolchain:
!gcc -c -DBUILDING_EXAMPLE_DLL file.c!gcc -shared -o file.dll file.o -Wl,--output-def,file.def,--out-implib,libfile.a!"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\"lib /def:file.defmex file_mex.c -L. -lfile -R2018a
Best Answer