Static linking a multi-threaded mex file in Matlab - Getting dependency error
trying to build a mex file using the MKL, which allows for
multi-threading and is statically linked. I use the following libraries:
'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', and 'libguide40' (The libguide40 can be omitted without linking error though).
when I run a simple vdCos command, I get a "Invalid mex-file: The
specified module could not be found." error. This states that a dll is
not present, but I tried doing static linking.... so I'm confused :)
I try a single-threaded link using the libraries 'mkl_intel_lp64',
'mkl_sequential', and 'mkl_core', Everything works fine ( I can
calculate a cos-value anyway). Hence... it is the threading stuff that
creates the linking error.
Is this working as intended, or am I doing something wrong?
Did you have difficulty when using libiomp5mt rather than libguide40? When using a static OpenMP library, you must take care that it is the only OpenMP library linked, and that it is linked subsequent to all .obj which introduce dependencies. Given that you have VC Express, vcomp shouldn't be getting in the way. If you had any OpenMP references from VC, libiomp5 would take care of them, while libguide would not, but that is not the only reason for preferring the libiomp.
Both the other libraries work fine. Only the libguide40.lib is creating this error.
So which library should I use? I will mostly be doing LU decomposition, and some transcendental functions calculation. From your reply, I guess you prefer the libiomp5mt. Will it make any difference to me?
it is no diferences for you which library to use libguide or libiomp5. These libraries contains OpenMP stuff and only difference between them is version of this stuff. I recommend to use libiomp5 library because it is newer than libguide.