<?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 Attempting to use MKL_RT.2.DLL in Delphi Pascal in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514178#M34954</link>
    <description>&lt;P&gt;We want to start using the MKL within our application and for that I have created a barebones console app. I'm receiving an mix of Access Exceptions and External Exception (can't find dependencies?). My first step debugging this was turning on verbose mode but this is also causing an issue. I'm attempting two main approaches:&lt;BR /&gt;&lt;BR /&gt;Compiling the code below into an executable and running it which fails. I've also attempted to use a cmd prompt first and running "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 ilp64 after which within the same cmd prompt I run my application. I'm running into multiple issues but would like to focus on the mkl_verbose call not working. When I pass a PInteger (integer pointer) I don't get an exception but it also doesn't start outputting to console. When I pass it as Integer I get an access exception. Could anyone help please? I'd be happy to provide more context or info incase necessary.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;unit MKL;

interface

uses sysutils;

type
  _MKL_DSS_HANDLE_t = array [0 .. 63] of Pointer;

var
  PARDISO: procedure (pt: Pointer; const maxfct, mnum, mtype, phase: PInteger; const n: PInteger; a: Pointer; ia, ja, perm: PInteger; const nrhs: PInteger; iparm: PInteger; const msglvl: PInteger; b, x: Pointer; error: PInteger); cdecl;
  PARDISO_64: procedure (pt: Pointer; const maxfct, mnum, mtype, phase: PInt64; const n: PInt64; a: Pointer; ia, ja: PInt64; perm: PInt64; const nrhs: PInt64; iparm: PInt64; const msglvl: PInt64; b, x: Pointer; error: PInt64); cdecl;
  PARDISOINIT: procedure (pt: Pointer; const mtype: PInteger; iparm: PInteger); cdecl;
  mkl_verbose: function (mode: Integer): Integer; cdecl;

implementation

uses
  Windows;

var
  MKLHandle: THandle;

procedure LoadMKL;
begin
  MKLHandle := LoadLibrary('C:\Program Files (x86)\Intel\oneAPI\mkl\2023.2.0\redist\intel64\mkl_rt.2.dll');
  if MKLHandle = 0 then
    raise Exception.Create('Could not load MKL library');

  @PARDISO := GetProcAddress(MKLHandle, 'pardiso');
  if not Assigned(PARDISO) then
    raise Exception.Create('Could not find PARDISO function');

  @PARDISO_64 := GetProcAddress(MKLHandle, 'pardiso_64');
  if not Assigned(PARDISO_64) then
    raise Exception.Create('Could not find PARDISO_64 function');

  @PARDISOINIT := GetProcAddress(MKLHandle, 'pardisoinit');
  if not Assigned(PARDISOINIT) then
    raise Exception.Create('Could not find PARDISOINIT function');

  &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/147775"&gt;@mkl&lt;/a&gt;_verbose := GetProcAddress(MKLHandle, 'mkl_verbose');
  if not Assigned(mkl_verbose) then
    raise Exception.Create('Could not find mkl_verbose function');
end;

initialization
begin
  LoadMKL;
  mkl_verbose(1);
end;

finalization
  if MKLHandle &amp;lt;&amp;gt; 0 then
    FreeLibrary(MKLHandle);

end.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Aug 2023 11:57:04 GMT</pubDate>
    <dc:creator>CodingInDelphiIn2023</dc:creator>
    <dc:date>2023-08-15T11:57:04Z</dc:date>
    <item>
      <title>Attempting to use MKL_RT.2.DLL in Delphi Pascal</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514178#M34954</link>
      <description>&lt;P&gt;We want to start using the MKL within our application and for that I have created a barebones console app. I'm receiving an mix of Access Exceptions and External Exception (can't find dependencies?). My first step debugging this was turning on verbose mode but this is also causing an issue. I'm attempting two main approaches:&lt;BR /&gt;&lt;BR /&gt;Compiling the code below into an executable and running it which fails. I've also attempted to use a cmd prompt first and running "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 ilp64 after which within the same cmd prompt I run my application. I'm running into multiple issues but would like to focus on the mkl_verbose call not working. When I pass a PInteger (integer pointer) I don't get an exception but it also doesn't start outputting to console. When I pass it as Integer I get an access exception. Could anyone help please? I'd be happy to provide more context or info incase necessary.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;unit MKL;

interface

uses sysutils;

type
  _MKL_DSS_HANDLE_t = array [0 .. 63] of Pointer;

var
  PARDISO: procedure (pt: Pointer; const maxfct, mnum, mtype, phase: PInteger; const n: PInteger; a: Pointer; ia, ja, perm: PInteger; const nrhs: PInteger; iparm: PInteger; const msglvl: PInteger; b, x: Pointer; error: PInteger); cdecl;
  PARDISO_64: procedure (pt: Pointer; const maxfct, mnum, mtype, phase: PInt64; const n: PInt64; a: Pointer; ia, ja: PInt64; perm: PInt64; const nrhs: PInt64; iparm: PInt64; const msglvl: PInt64; b, x: Pointer; error: PInt64); cdecl;
  PARDISOINIT: procedure (pt: Pointer; const mtype: PInteger; iparm: PInteger); cdecl;
  mkl_verbose: function (mode: Integer): Integer; cdecl;

implementation

uses
  Windows;

var
  MKLHandle: THandle;

procedure LoadMKL;
begin
  MKLHandle := LoadLibrary('C:\Program Files (x86)\Intel\oneAPI\mkl\2023.2.0\redist\intel64\mkl_rt.2.dll');
  if MKLHandle = 0 then
    raise Exception.Create('Could not load MKL library');

  @PARDISO := GetProcAddress(MKLHandle, 'pardiso');
  if not Assigned(PARDISO) then
    raise Exception.Create('Could not find PARDISO function');

  @PARDISO_64 := GetProcAddress(MKLHandle, 'pardiso_64');
  if not Assigned(PARDISO_64) then
    raise Exception.Create('Could not find PARDISO_64 function');

  @PARDISOINIT := GetProcAddress(MKLHandle, 'pardisoinit');
  if not Assigned(PARDISOINIT) then
    raise Exception.Create('Could not find PARDISOINIT function');

  &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/147775"&gt;@mkl&lt;/a&gt;_verbose := GetProcAddress(MKLHandle, 'mkl_verbose');
  if not Assigned(mkl_verbose) then
    raise Exception.Create('Could not find mkl_verbose function');
end;

initialization
begin
  LoadMKL;
  mkl_verbose(1);
end;

finalization
  if MKLHandle &amp;lt;&amp;gt; 0 then
    FreeLibrary(MKLHandle);

end.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 11:57:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514178#M34954</guid>
      <dc:creator>CodingInDelphiIn2023</dc:creator>
      <dc:date>2023-08-15T11:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to use MKL_RT.2.DLL in Delphi Pascal</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514984#M34964</link>
      <description>&lt;P&gt;Alright I got MKL Pardiso working in Delphi Pascal so this question can be closed. If there's interest I could explain the process. The main issue is in the Environment Variables and correctly crafting the right signature / using the correct types.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 12:43:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514984#M34964</guid>
      <dc:creator>CodingInDelphiIn2023</dc:creator>
      <dc:date>2023-08-17T12:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to use MKL_RT.2.DLL in Delphi Pascal</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514994#M34965</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for posting in Intel Communities.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;Alright I got MKL Pardiso working in Delphi Pascal so this question can be closed.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Glad to know that your issue is resolved.&amp;nbsp;&lt;SPAN&gt;In case you run into any other issues, please feel free to create a new thread.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;If there's interest I could explain the process&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Sure! You can share your findings here, as it helps other users with similar issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Varsha&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 12:39:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Attempting-to-use-MKL-RT-2-DLL-in-Delphi-Pascal/m-p/1514994#M34965</guid>
      <dc:creator>VarshaS_Intel</dc:creator>
      <dc:date>2023-08-24T12:39:44Z</dc:date>
    </item>
  </channel>
</rss>

