Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6590 Discussions

Concerning custom dll static linking, dll called from C# side

alexey_k_2
Beginner
222 Views

Good Day!

I ve installed Intel MKL 11.3 and all C/C++ colsole application samples are firing. I also have working mixed (unmanaged/managed ) application where i try to improve performance using Intel MKL. So normally managed application is calling unmanaged functions by Platform Invoke methods. Nothing unusual.

Problems begin with my custom dll calls Intel MKL, libintel64 and 2nd C# example.

I ve setup up environement as described in Getting Started guides, articles, MS VS Studio C/C++ linking tutrorial. I ve ran "mklvars.bat intel64".

  1. If I compile with static linking to mkl_intel_lp64_dll.lib mkl_core_dll.lib mkl_intel_thread_dll.lib libiomp5md.lib linker cant find files. If I leave only libiomp5md.lib – it is found. Same with libintel64 prototype example.
  2. If I compile without static linking to mkl_intel_lp64_dll.lib mkl_core_dll.lib mkl_intel_thread_dll.lib libiomp5md.lib – custom dll is created but problems begin later.
  3. If I create my custom DLL without static linking to intel mkl libs – it compiles, when I call it from C# app – not found exception occurs. Ok I copy then mkl_core_dll.dll mkl_intel_thread_dll.dll libiomp5md.dll to C# assembly directory. App looks starting well but on second call of my custom dll function I receive error: not found entry point. If I rebuild my custom dll without Intel MKL – everything fires with my default functions.
  4. First C# turorial example fires. Second C# tutorial shows it cant find mkl_intel_lp64_dll.lib and example shuts down with dll not found exception.

Seems I have tried all kind of settings, including paths etc, i copied them directly from directory paths, I ve ran mklvars.bat with IA32 and Intel64 variants. I also tried switch on/off enums in Intel MKL settings in project properties. Nothings helps.

So need assistance.

Thanks in advance.

 

Alexey

 

 

 

0 Kudos
1 Reply
Zhen_Z_Intel
Employee
222 Views

Hi alexey, 

I am afraid the way of linking MKL in C# code is different from the way of using MKL in C/C++ program. Here's an article for using the Intel MKL in C# code, please follow it to run the batch file setting environment variables. It is unnecessary to link libraries in visual studio manually. And by the way, the mkl_intel_lp64_dll.lib, mkl_core_dll.lib, and mkl_intel_thread_dll.lib are dynamic libraries in lib\intel64_win Directory. Hope it could help you.

Useful link: Using Intel® MKL in your C# programSome more additional tips "How to call MKL from your C# code"

Reply