<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Having trouble referencing/creating MKL.DLL in Visual C# Studio in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067687#M22015</link>
    <description>&lt;P&gt;I am having a terrible time setting up Intel's Math Kernel for Visual C#. I have downloaded and ran the install file with no luck of accessing the Math Kernel Functions inside of the mkl.dll file. When I implement one of mkl.dll functions a BadImageFormatException is thrown. Online documentations instructs you to go through the visual studio command prompt and call:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "mklvars.bat" ia32
&amp;nbsp;&amp;nbsp;&amp;nbsp; nmake ia32&lt;/PRE&gt;

&lt;P&gt;When I run this throught the shell mklvars.bat ia32 is accepted and nmake ia32 throws and it throws an error within&amp;nbsp; the command prompt.&lt;/P&gt;

&lt;P&gt;I tried using the MKL_Link_Tool.exe with the following result and still receive the bad image exception:&lt;/P&gt;

&lt;P&gt;&lt;IMG alt="" src="http://i.stack.imgur.com/SPB4O.png" /&gt;&lt;/P&gt;

&lt;P&gt;Code:&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Program
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static class MKL
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DllImport("mkl.dll", CallingConvention = CallingConvention.Cdecl)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; internal static extern int DftiCreateDescriptor(ref IntPtr desc,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int precision, int domain, int dimention, int length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [STAThread]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IntPtr pnt = new IntPtr(32);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(MKL.DftiCreateDescriptor(ref pnt, 1, 1, 10, 10) + "");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (BadImageFormatException ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.WriteLine(ex.Message);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	I can't figure out how to use Intel's Math Kernel Library with Visual Studio... Can anyone help me set up MKL (escpicially the BLAS and LA packages) Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Dec 2015 19:50:20 GMT</pubDate>
    <dc:creator>Michael_C_16</dc:creator>
    <dc:date>2015-12-29T19:50:20Z</dc:date>
    <item>
      <title>Having trouble referencing/creating MKL.DLL in Visual C# Studio</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067687#M22015</link>
      <description>&lt;P&gt;I am having a terrible time setting up Intel's Math Kernel for Visual C#. I have downloaded and ran the install file with no luck of accessing the Math Kernel Functions inside of the mkl.dll file. When I implement one of mkl.dll functions a BadImageFormatException is thrown. Online documentations instructs you to go through the visual studio command prompt and call:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "mklvars.bat" ia32
&amp;nbsp;&amp;nbsp;&amp;nbsp; nmake ia32&lt;/PRE&gt;

&lt;P&gt;When I run this throught the shell mklvars.bat ia32 is accepted and nmake ia32 throws and it throws an error within&amp;nbsp; the command prompt.&lt;/P&gt;

&lt;P&gt;I tried using the MKL_Link_Tool.exe with the following result and still receive the bad image exception:&lt;/P&gt;

&lt;P&gt;&lt;IMG alt="" src="http://i.stack.imgur.com/SPB4O.png" /&gt;&lt;/P&gt;

&lt;P&gt;Code:&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class Program
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static class MKL
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [DllImport("mkl.dll", CallingConvention = CallingConvention.Cdecl)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; internal static extern int DftiCreateDescriptor(ref IntPtr desc,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int precision, int domain, int dimention, int length);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [STAThread]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main(string[] args)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IntPtr pnt = new IntPtr(32);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Write(MKL.DftiCreateDescriptor(ref pnt, 1, 1, 10, 10) + "");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (BadImageFormatException ex)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.WriteLine(ex.Message);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	I can't figure out how to use Intel's Math Kernel Library with Visual Studio... Can anyone help me set up MKL (escpicially the BLAS and LA packages) Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:50:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067687#M22015</guid>
      <dc:creator>Michael_C_16</dc:creator>
      <dc:date>2015-12-29T19:50:20Z</dc:date>
    </item>
    <item>
      <title>Assuming that you have</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067688#M22016</link>
      <description>&lt;P&gt;Assuming that you have downloaded and extracted the three zip files at &lt;A href="https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program?wapkw=mkl%20c%23" target="_blank"&gt;https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program?wapkw=mkl%20c%23&lt;/A&gt;, before running "nmake ia32"&amp;nbsp;on a 64-bit system you have to set the environment variable&amp;nbsp;CSCOPTS=/platform:x86 (to receive this information, run the command &lt;STRONG&gt;nmake help&lt;/STRONG&gt;).&lt;/P&gt;

&lt;P&gt;To do the same from Visual Studio, from the IFort command window run devenv, and create a new C# console project, add the C# source code to the project, select the configuration and build.&lt;/P&gt;

&lt;P&gt;Note that the examples are all set up to run, output results to the console and quit, so you may want to put a breakpoint at the last source line of Main before running each program.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2015 23:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067688#M22016</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-12-29T23:12:00Z</dc:date>
    </item>
    <item>
      <title>Hi Michael,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067689#M22017</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;

&lt;P&gt;If possible, could you please use dependency walker to detect if all dlls are founded. as the article described&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/some-more-additional-tips-how-to-call-mkl-from-your-c-code/"&gt;https://software.intel.com/en-us/articles/some-more-additional-tips-how-to-call-mkl-from-your-c-code/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In order to avoid the dynamic library environment check, you may first to try mkl_intel_c.lib mkl_sequential.lib mkl_core.lib. which is static library and sequential library. then try other configuration.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Dec 2015 03:59:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Having-trouble-referencing-creating-MKL-DLL-in-Visual-C-Studio/m-p/1067689#M22017</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2015-12-31T03:59:36Z</dc:date>
    </item>
  </channel>
</rss>

