tags:

views:

49

answers:

1

I'm trying to connect to MySQL using MATLAB R2009b 64 bit and the mysql.cpp file found on the FEX and here. I followed all the steps to compile listed in the second link. After entering the following:

mex -I"C:\mysql\include" -DWIN32 mysql.cpp "C:\mysql\lib\opt\libmySQL.lib"

the mysql.mexw64 file is created in my working directory. However, when I go to test it, I get the following error:

>> mysql('status')
??? Invalid MEX-file 'C:\[path]\mysql.mexw64': C:\[path]\mysql.mexw64 is not a valid Win32 application.

I tried switching out the -DWIN32 with -DWIN64, but that just threw all sorts of errors. Anyone have a suggestion as to why this isn't working?

I'm using MATLAB R2009b 64 bit on Windows 7 64 bit.

+1  A: 

libmysql.dll is a 32-bit library. Matlab 64-bit wants mex-files to be compiled in 64-bit mode. Unless you can recompile the library, you won't be able to get the mex-file to work, I'm afraid.

Jonas