ExcelDNA does not find native DLL

Dec 1, 2014 at 10:54 AM
Dear Govert,

first of all congratulations to this great tool!
However, I try do do some strange stuff with it, which makes me trouble, so I hope you could give me some help.

I want to create some Excel UDFs.
Due to historic and compability reasons, the code for the UDFs is distributed in very different pieces:
  • VB.net code => compiled to managed .NET DLL
  • pascal code => compiled to native DLL
  • C++ code => The basic calculation is done within a class structure so it would be quite lenghtly to extract all parameters using "declace function". So I wrote a managed C++ class to wrap the unmanaged C++ class.
Finally I have one VB.NET class defining the UDFs.
This class references the other VB.NET code, the pascal code using "declare function" and the managed C++ wrapper directly using the class (Dim example as ManagedWrapperClass).

In the ExcelAddin.DNA file I included the UDF definition class as "ExternalLibrary" and the other .NET class using "Reference" and "pack=true".

Everything compiles and a XLL is generated.
In the directory I place the XLL as well as the pascal and the (wrapped) C++ DLL.

On my computer everything works well: all calculations are done. The calculation stops working, when I remove or rename one of the native DLLs.
On a computer of a collegue, who also did some work with ExcelDNA, the XLL works as well.

But if I try to use the XLL on other machines, I get a "C++ library or subcomponent not found" error. (I tried three other machines so far).

I have no idea where to place a search path or where to look. Does ExcelDNA do some registering during packing I need to do on the other machines as well?

I hope you could give me some helping idea.

Best regards,

Andreas
Coordinator
Dec 1, 2014 at 11:11 AM
Excel-DNA does not support packing native or mixed libraries.
But as long as you have all the required libraries in that directory, this should not matter.

Excel-DNA does no registering during packing.

I suspect your issue is that the Visual C++ runtime needs to be installed. You can download the Visual C++ Redistributable from Microsoft. Note that installing a newer version than the one you need probable won't work - so you need to get the version that matches what the C++ library needs.
If you are compiling all the C++ code yourself, you might also change from dynamic linking the runtime to statically linking the runtime. That's much better.

-Govert
Dec 2, 2014 at 7:37 AM
Dear Govert,

thank you very much for your quick answer!

Your point was the clue! It turned out that the problem was two-folded:
  • one one computer the redistributable was missing
  • further more the C++ DLL was compiled using the "debug" flag and obviosly the debug-DLLs are not included in the redistributables.
    => compiling using "release" flag fixed that problem.
Thanks a lot for your help,

best regards,

Andreas