Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7230 Discussions

Can you do static (or dynamic?) linking of MKL functions into user's static library?

CCar
Beginner
854 Views

Can you do static (or dynamic?) linking of MKL functions into a user's static library?

(Visual studio 8, VC++)

If so, how do you avoid the unresolved external symbol errors for all the MKL functions called from the user's library?

I can do linking just find into executable codes, but haven't had any luck getting my static library with mkl calls to link in.

Thanks for any help.

0 Kudos
5 Replies
Cijo_Abraham_Mani
853 Views
Quoting - CCar

Can you do static (or dynamic?) linking of MKL functions into a user's static library?

(Visual studio 8, VC++)

If so, how do you avoid the unresolved external symbol errors for all the MKL functions called from the user's library?

I can do linking just find into executable codes, but haven't had any luck getting my static library with mkl calls to link in.

Thanks for any help.

You can do both static and dynamic linking using MKL function into user static library. The high level libraries and threading softwares of MKL makes this possible , the libguide.a for static and libguide.so for dynamic . Turn off the Basic Runtime Checks (disable /RTC) and Buffer Security Checks (/GS) and try out .

0 Kudos
Andrey_Bespalov
New Contributor I
854 Views

It is possible to create such static library, but it is not "one button" solution.

You should determine which files from MKL static libraries is required, extract them and add to your static library.

To determine which files are required you can build your application or "custom" DLL (tools/builder) with generation of map file.

0 Kudos
CCar
Beginner
854 Views

It is possible to create such static library, but it is not "one button" solution.

You should determine which files from MKL static libraries is required, extract them and add to your static library.

To determine which files are required you can build your application or "custom" DLL (tools/builder) with generation of map file.

I have been able to link the MKL libraries dynamically to my static library. As expected, then my project settings on my executable program also needed to include the mkl_c_dll.lib, etc libraries so that it would not have unresolved external function errors. This is not quite how I wanted it to work, but it does work this way.

Also, I was trying to use the non-threading libraries in my static library, but I don't understand why it forced me to include the mkl_intel_thread_dll.lib for the executable or else it wouldn't finish linking.

0 Kudos
CCar
Beginner
854 Views
Quoting - cijoaj2003

You can do both static and dynamic linking using MKL function into user static library. The high level libraries and threading softwares of MKL makes this possible , the libguide.a for static and libguide.so for dynamic . Turn off the Basic Runtime Checks (disable /RTC) and Buffer Security Checks (/GS) and try out .

Aren't .a and .so libraries for UNIX type compilations? Don't you have to use .lib under windows?

0 Kudos
Andrey_Bespalov
New Contributor I
854 Views
Quoting - CCar

I have been able to link the MKL libraries dynamically to my static library. As expected, then my project settings on my executable program also needed to include the mkl_c_dll.lib, etc libraries so that it would not have unresolved external function errors. This is not quite how I wanted it to work, but it does work this way.

Also, I was trying to use the non-threading libraries in my static library, but I don't understand why it forced me to include the mkl_intel_thread_dll.lib for the executable or else it wouldn't finish linking.

You should use mkl_sequential_dll.lib instead of mkl_intel_thread_dll.libif you want to use non-threaded version.

0 Kudos
Reply