dll import causes crash

 

hello together,

although my english is not very well i'd like to ask the experts what i do wrong with calling a function in a dll ...

i created a c-dll that includes the function SCORE ... this needs an indata and outdata array and does some calculating ...

-----------------------------------------------------------------------------------------------

CODE of th c-program:

#include <math.h>
#include <string.h>
#include <memory.h>
#include <ctype.h>

#include "neural_header.h"
#include "cscore.h"

#define csCLOSE indata[0].data.fnum
#define csCLOSE_1 indata[1].data.fnum

... and so on

#define csVOLUME_9 indata[74].data.fnum

#define csEM_PREDICTION outdata[0].data.fnum
#define csP_TARGET outdata[1].data.fnum
#define cs_WARN_ outdata[2].data.str

SFDKeyWords void __stdcall score( PARM *indata, PARM *outdata )
{

/*--- Auto Variables ---*/
double csH11;
double csH12;

.... and so on

double cs_NOCL_;
double cs_NTRIALS;
double cs_SUM_;

strcpy(cs_WARN_," ");

/*--- initialize stand alone formats library ---*/
#if FMTLIB == 1
xfinit();
#endif

cs_DM_BAD =0;

/** **************************/
/** writing the node intervaltargets */
/** **************************/
if ( cs_DM_BAD== 0)
{
csP_TARGET = 7.71649047510018;
/********************************/
/** end scoring code for neural*/
/********************************/
/*------------------------------------------------------------**/
/* tool: score node*/
/* type: assess*/
/* node: score*/
/*------------------------------------------------------------**/
/*------------------------------------------------------------**/
/* score: creating fixed names*/
/*------------------------------------------------------------**/
csEM_PREDICTION = csP_TARGET;

return;

}
usrNbucket usrnBuckets[]={
/* not used */
{0,0,0,NULL,NULL,' ',0.0}
};

usrCbucket usrcBuckets[]={
/* not used */
{NULL, NULL, 0, NULL}

};
usrFormat usrnFormats[] = {
{"**unused**",0.0,0,0,0,-1,-1,0}
};
usrFormat usrcFormats[] = {
{"**unused**",0.0,0,0,0,-1,-1,0}
};
int usrNumNfmts = 0;
int usrNumCfmts = 0;

--------------------------------------------------------------------

now i want to read the value outdata[1].data.fnum from metatrader and i include the dll and the function what works well ...

the following script code crashes the terminal and i have no idea what is happening, because i'm not a very good programmer ...

--------------------------------------------------------------------

//+------------------------------------------------------------------+
//| kev_01_dll.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#include <kev_01_include.mqh>

//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int i, // Bar index
k, // Index of indicator array element
Counted_bars, // Number of counted bars
j; //Zähler für das array

double input_array[74],
output_array[3];

//--------------------------------------------------------------------

//das input array befüllen
for(j=0;j<=74;j++)
input_array[j]=Close[j];

score(input_array,output_array);

//----
return(0);
}
//+------------------------------------------------------------------+

maybe someone can help me with this critical error :

There has been a critical error
Time : 2009.01.12 18:02
Program : Client Terminal
Version : 4.00 (build: 220, 7 Nov 2008)
OS : Windows Vista Professional 6.0 Service Pack 1 (Build 6001)
Processors : 1 x X86 (level 15)
Memory : 784832/214420 kb
Exception : C0000005
Address : 75EDCC95
Access Type : write
Access Addr : 00000000

Registers : EAX=40C0C0C0 CS=001b EIP=75EDCC95 EFLGS=00010246
: EBX=FFFFFFFF SS=0023 ESP=0787F578 EBP=0787FA98
: ECX=66F49144 DS=0023 ESI=06D2AC58 FS=003b
: EDX=20202020 ES=0023 EDI=00000000 GS=0000

Stack Trace : 004586F5 00463C57 004554D1 75ED2DEB
: 77114911 774EE4B6 774EE489 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000

Modules :
1 : 00400000 00502000 c:\program files\metatrader - activtrades\terminal.exe
2 : 10000000 00005000 c:\windows\system32\avgrsstx.dll
3 : 66F40000 00010000 c:\program files\metatrader - activtrades\experts\libraries\kev_01.dll
4 : 6CF40000 00038000 c:\windows\system32\odbcint.dll
5 : 6CF80000 0011B000 c:\windows\system32\mfc42.dll
6 : 6E820000 00065000 c:\windows\system32\odbc32.dll
7 : 74580000 00039000 c:\windows\system32\oleacc.dll
8 : 745C0000 00032000 c:\windows\system32\winmm.dll
9 : 749B0000 0003F000 c:\windows\system32\uxtheme.dll
10 : 749F0000 0019E000 c:\windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\comctl32.dll
11 : 74EC0000 00005000 c:\windows\system32\wshtcpip.dll
12 : 74F80000 00005000 c:\windows\system32\msimg32.dll
13 : 75040000 0003B000 c:\windows\system32\rsaenh.dll
14 : 752C0000 0003B000 c:\windows\system32\mswsock.dll
15 : 75D30000 0001E000 c:\windows\system32\imm32.dll
16 : 75D50000 0009D000 c:\windows\system32\user32.dll
17 : 75DF0000 0007D000 c:\windows\system32\usp10.dll
18 : 75E70000 00045000 c:\windows\system32\iertutil.dll
19 : 75EC0000 000AA000 c:\windows\system32\msvcrt.dll
20 : 76190000 00003000 c:\windows\system32\normaliz.dll
21 : 761A0000 00144000 c:\windows\system32\ole32.dll
22 : 762F0000 000D0000 c:\windows\system32\wininet.dll
23 : 763C0000 00073000 c:\windows\system32\comdlg32.dll
24 : 76440000 000C6000 c:\windows\system32\advapi32.dll
25 : 76510000 00009000 c:\windows\system32\lpk.dll
26 : 76520000 00B10000 c:\windows\system32\shell32.dll
27 : 77080000 0004B000 c:\windows\system32\gdi32.dll
28 : 770D0000 000DB000 c:\windows\system32\kernel32.dll
29 : 771E0000 000C2000 c:\windows\system32\rpcrt4.dll
30 : 772B0000 000C8000 c:\windows\system32\msctf.dll
31 : 774B0000 00127000 c:\windows\system32\ntdll.dll
32 : 775E0000 0008D000 c:\windows\system32\oleaut32.dll
33 : 77670000 00006000 c:\windows\system32\nsi.dll
34 : 77680000 00058000 c:\windows\system32\shlwapi.dll
35 : 776E0000 0002D000 c:\windows\system32\ws2_32.dll

Call stack :

thanxx so much if anybody would give me an answer ...

sonado

Reason: