I am trying to use the MKL FFTW library as called from a Matlab mexfunction and am getting an "access violation" when trying to create a plan (I have done this successfully using the FFTW libraries from their website but want to compare results to MKL FFTW). My simplfied test code (modified from Intel's example file) is named "mkl_test_fftw.f90,
subroutine mexfunction(nlhs, plhs, nrhs, prhs)
integer nlhs, nrhs
integer plhs(nlhs), prhs(nrhs)
integer, parameter :: fftw_forward = -1
integer, parameter :: fftw_estimate = 64
integer, parameter :: n = 10
! Get access violation when trying to run the next line
call dfftw_plan_1d(plan, n, in, in, fftw_forward, fftw_estimate)
end subroutine mexfunction
I compile using the Matlab MEX utility (static linking and Intel Fortran visual compiler),
>> mex mkl_test_fftw.f90 mkl_c.lib fftw3xf_ms.lib libguide40.lib
where,fftw3xf_ms.lib was compiled using the Microsoft C-compiler from MSVS and libguide40.lib is from the Intel compiler directory, not the one supplied with MKL (as instructed in the MKL user manual). I tried using libguide from the MKL directory as well but that did not make a difference.
The mexopt.bat file (supplied by Matlab) has all of the PATHs, INCLUDE, etc... to the Intel compiler and MKL libraries.
Is therea DLL or LIBthat I am missing when trying to run this code. It compiled perfectly but can not find the FFTW library when executing(?).
Thank you very much for your time. Any help that someone could provide would be greatly appreciated.