I have a class that creates a dll implemented as a single solution. In its header file, I have a structure with an element being a vector. eg:
// dll.h struct ScanParam16 { // int param int nChanDetX, nChanDetZ; int nViewPerRot, nViewPerSlice, nChanDetXPerMod; int nImgXY, nImgZ; int nSlicePerProcess, n2Group; int FFTLen; // float param float pitch; float isoOffX, isoOffZ; float fov, dfov; float imgCentX, imgCentY, imgCentZ; float sdd, srad, drad; float dDetX, dDetZ, dDetU, dDetV, interModGapX, dDetSampleRes; std::vector<float> winArray; bool interleave; // enum bpInterpType16 iType; };
In the code that calls this DLL, the winArrar vector is evaluated as follows:
// caller.cpp static ScanParam16 param; param.FFTLen = 2048; float* wArray = new float[param.FFTLen]; GenKernCoef(wArray, param.FFTLen, kType, ParaDataFloat, aram.dDetSampleRes); std::vector<float> v(wArray, wArray+param.FFTLen); param.winArray = v;
Now everything looks good. I see that param.winArray is set correctly with the correct values.
However, when I pass param as a parameter, param.winArray becomes 0 in quality / length, as I observe inside the dll.
Here's how the parameter is passed:
Above is the point located immediately before passing the parameter to the dll.
And below is the point at which the parameter falls inside the dll:
// dll.cpp void ReconAxial16::Init(const ScanParam16& param ) { /**************************************************************/ // setup geometry and detv /**************************************************************/ SetupGeometry(param); // Allocate buffer for reconstructed image (on cpu side) _img = (float *)malloc(_nImgXY * _nImgXY * sizeof(float)); ...... }
Here, when I enter, I see that param.winArray has a length of 0, but all other parameters look fine.
I canβt stand it and am wondering how to correctly convey the vector? Thank you very much.