I am using XLW to create an XLL of functions to register in Excel. The XLL calls the actual mathematical models in a C++ DLL.
I am using BOOST with UBLAS to aid in conversion from the XLL MyMatrix data type to the double ** that the C++ DLL uses for input. This builds correctly, and I can use the functions with array inputs and outputs correctly in my development environment.
However when I install my Excel Add-In on a destination computer, with an InstallShield installer, The functions with array inputs are returning "Conversion to double" errors, rather than the function's return value from the C++ DLL.
This is what I've tried so far, with no luck:
1.Using BOOST BCP to collect all of the Numeric library (UBLAS wasn't coming up), and I included it in my Visual Studio 2013 project. I then took BOOST_ROOT out of the include and using project properties, so that it would use what was in the project (from my limited understanding)
Install all of the Microsoft C++ Redistributables for both bitnesses on the destination computer.
Download and build BOOST on the destination computer, and create environment variable of BOOST_ROOT. Installed XLW on destination computer, and matched all environment variables in the development environment on the destination computer.
Used Dependency Walker to verify all dependent DLLs were on the destination computer.
All with no luck. What do I need to include with my installer? Thank you for your time.
Development Environment: Windows 10 with Visual Studio 2013 and 2015
Destination Computer: Windows 10 with Office 2016
MyMatrix Declared:
namespace xlw {
#ifdef USE_XLW_WITH_BOOST_UBLAS
#define USE_PARENTHESESES
typedef boost::numeric::ublas::matrix<double> MyMatrix;
typedef boost::numeric::ublas::vector<double> MyArray;
typedef MyMatrix NEMatrix;
MyMatrix in function declaration:
MyMatrix
ExcelFunctionName(
double Function,
double ReportDate,
double TotalOptIssued,
double PrevestForfOpt,
double NonvestedOpt,
double ExpectedTurnoverRate,
const MyMatrix VestingSchedule
Calling C++ DLL and using Box to convert MyMatrix to double **
Error err = CPPDLLFunctionName(Function, ReportDate, TotalOptIssued, PrevestForfOpt, NonvestedOpt, ExpectedTurnoverRate,
VestingSchedule.size1(), VestingSchedule.size2(), Box(VestingSchedule).m, Box(out).m);
Box doing the conversion
#include <boost/numeric/ublas/matrix.hpp>
using namespace boost::numeric::ublas;
class Box {
public:
double **m;
Box(const matrix<double>& t) {
m = static_cast<double **>(malloc(static_cast<size_t>((t.size1())*sizeof(double*))));
for (size_t i = 0; i < t.size1(); i++)
m[i] = const_cast<double*>(&(t.data()[i*t.size2()]));
}
~Box() { free(static_cast<void *>(m)); }
};
I had included the Visual C++ 12.0 CRT (x64) in the installer, because this was a 64 bit XLL in VS 2013 format, however it turns out I also needed to include Visual C++ 12.0 CRT (ARM). I welcome anyone's comments on why I needed to include this. Thanks!