Call a c++ dll with stl container from .net

Having the following function in a native dll:

double sum (std::vector<double> vals)
{
    double s = 0.0;
    for (size_t = 0; i < vals.size(); i++)
    {
        s += vals[i]
    }
    return s;
}

How can I make it callable from .net (c#) ?

The problem is, that there is no pair for vector<double>.

Is it possible to alter the c++ side to make the call possible? (without giving up any std c++ feature, including the ability to call other c++ libraries )


Source: dll

Leave a Reply