05-28-2020 09:55 AM
Dear all,
I'm trying to load a .dll in labview that I generated from C++ using code::blocks.
This simple .dll is just a test copying a input vector to the output (vector also).
The process crashes during import.
I attached the .cpp and .h file for information
Are vectors handled in Labview ?
Any help would be very much appreciated here
PS : it wouldn't let me attach the .cpp file so I copy past the very simple code here bellow ( the header file is in attachment )
#include "mainRItoIR.h"
void DLL_EXPORT testInputOutput(std::vector<double> &output, std::vector<double> input)
{
output = input;
}
thanks so much
Oliver
05-29-2020 05:46 AM - edited 05-29-2020 05:49 AM
You can not pass C++ objects to a Call Library Node function. C++ object ABI are compiler specific so LabVIEW has no way to even try to implement them in a compiler independent manner. Therefore NI never even attempted to do that.
You need to pass standard memory pointers to the DLL.
void DLL_EXPORT testInputOutput(double *output, double *input, int numElm)
{
memcpy(output, input, numElm * sizeof(double));
}
And you need to preallocate the output array in LabVIEW of course!
06-02-2020 05:12 AM
Hi Rolfk,
Thanks so much for your great help, this saved my life.
Thanks again !
Best regards
Oliver