Hi everyone,
I am a student,quite new to C++. I am working on my thesis right now. Here is my situation, I have an algorithm for my thesis topic and I tried making an example of this in C++ and it works fine with a console application. But I am doing this for a company with whom I am doing my internship and they already have an application this field. They want me to implement my algorithm in their application. This application has an option to call .dll file which I am planning to use. This application has some libraries which I can use. I also tried to make a small mathfunctions example and it works fine. but when I use for loops inside the dll file the program freezes and doesn't run anymore.
below is the skeleton of the .cpp file. I am supposed to write my code in the user program area. Another problem I am facing is the array data can be accessed only by calling pre defined functions from the lib file like getdata, setdata.. etc.
#include "stdafx.h"
#include <windows.h>
#include "C:\users\include\libpltUsrSafeArray.h "
int ADD(DWORD dwArgumentCount, VARIANT * pvArgument)
{
HRESULT hr = S_OK;
int rtn = 0;
LPSAFEARRAY psfarray01 = NULL; /* Input MTX(MATRIX01) */
hr = ::SafeArrayCopy(pvArgument[0].parray, &psfarray01);
double ddata02 = 0; /* Output VALUE01 */
double ddata03 = 0; /* Output VALUE02 */
/***** User Program *****/
/* user program is written here*/
PLTSArrayGetSize(psfarray01, rowsize, colsize); /*pre defined function to get array size */
/***** User Program *****/
if( psfarray01 ) {
::SafeArrayDestroy( psfarray01 );
psfarray01 = NULL;
}
pvArgument[1].dblVal = ddata02;
pvArgument[1].vt = VT_R8;
pvArgument[2].dblVal = ddata03;
pvArgument[2].vt = VT_R8;
return(rtn);
}
would be helpful if someone could suggest how to approach this.