1

I have used ILNumerics via Excel DNA in Excel successfully for some time. Now I wrote a new function which uses the linsolve function from ILNumerics (which needs the mkl_custom.dll) and I cannot build this into an XLL. My custom function works in debug which is why I assume sth in the packaging goes wrong.

Here is my dna file:

<DnaLibrary Name="Nik's Lib" RuntimeVersion="v4.0">
   <ExternalLibrary Path="MyLib2010.dll" Pack="true"/>
   <Reference  Path="ILNumerics.dll" Pack="true"/>
   <Reference  Path="mkl_custom.dll" Pack="true"/>
</DnaLibrary>

When packaging this I get the error message that path for mkl_custom.dll

path not found

This might be due to the folder structure of the dll:

enter image description here

Any pointers on how to resolve this would be appreciated.

nik
  • 1,672
  • 2
  • 17
  • 36

1 Answers1

2

The Excel-DNA packing does not currently support native or mixed assemblies. So you won't be able to use the mechanism to pack the mkl library.

You might be able to store it in your C# assembly as a resource, and extract it yourself at runtime (in an AutoOpen or something, before any of the functions using it are run). If you extract it to a temp file, then call LoadLibrary yourself to load it into the process, it should work when ILNumerics needs it.

Govert
  • 16,387
  • 4
  • 60
  • 70
  • thank you Govert! Could you please elaborate a bit? You mean I should use Assembly.loadfrom() or [DLLImport()] or how would I do this please? – nik Jun 17 '15 at 06:02
  • Another, easier way would be to use the current version. It comes with an installer which installs the mkl and all managed assemblies systemwide. That way you don't have to deal with bin32/ bin64/ folders anymore. – Haymo Kutschbach Jun 17 '15 at 07:48
  • @HaymoKutschbach: ok, that would be easiest but I only installed ILNumerics this week via NuGet Package. How would I get the new version then? Thank you! – nik Jun 17 '15 at 08:19
  • @HaymoKutschbach: Thank you, but this is only a 14day trial version. I will try to make Govert's way work – nik Jun 18 '15 at 06:49