1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
namespace MT4_Export
{
class MyFunctions
{
public:
__declspec(dllexport) int XPortCurBar(double HIGH, double LOW, double OPEN, double CLOSE, int VOLUME);
__declspec(dllexport) double* XPortBarArray(double* InArr[][6], int szRows, int szCols);
__declspec(dllexport) char* XPortMsg(string XMsg);
};
int XPortCurBar(double High, double Low, double Open, double Close, int Volume)
{
return 0;
}
double* XPortBarArray(double **inArray[], unsigned szRow, unsigned szCol=6)
{
/**
0 - time,
1 - open,
2 - low,
3 - high,
4 - close,
5 - volume.
**/
double* first = inArray[0][4];
return first; //first;
}
char* XPortMsg(char* inmsg)
{
char* mHeader = "DLL Received: ";
// retrieve incoming string and assign to variable
char* msgHeader = new char[strlen(inmsg)+1];
memcpy(msgHeader,inmsg,strlen(inmsg)+1);
msgHeader[strlen( inmsg )] = '\0';
char* retVal = new char[strlen(mHeader)+strlen(msgHeader)+1];
*retVal = '\0';
// Assemble the string
strcat(retVal,mHeader);
strcat(retVal,msgHeader);
return retVal;
}
}
|