MT4 DLL 调用问题
Dear all: 初次发贴,多多关照! 各位高手 帮我解答个问题 我利用Mt4 例子程序生成DLL 想实现文件的copy 创建了下面一个函数 mt4 在调用的时候 平台死掉 是啥原因呢 //======================================================= MT4_EXPFUNC bool __stdcall Mt4CopyFile(char *s,char *d) { FILE *fp1,*fp2; if((fp1=fopen(s,"r"))==NULL) { printf("Cannot open Source file!n"); exit(0); } if((fp2=fopen(d,"w"))==NULL) { printf("Cannot open Destination file!n"); exit(0); } while(!feof(fp1)) fputc(fgetc(fp1),fp2); fclose(fp1); fclose(fp2); return 0; } //============================= 下面是源码 //+------------------------------------------------------------------+ //| Sample DLL for MQL4 | //| Copyright ?2004-2006, metaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include #include #include //---- #define MT4_EXPFUNC __declspec(dllexport) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ #pragma pack(push,1) struct RateInfo { unsigned int ctm; double open; double low; double high; double close; double vol; }; #pragma pack(pop) //---- struct MqlStr { int len; char *string; }; static int CompareMqlStr(const void *left,const void *right); //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) { //---- switch(ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } //---- return(TRUE); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ MT4_EXPFUNC int __stdcall GetIntValue(const int ipar) { printf("GetIntValue takes %dn",ipar); return(ipar); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ MT4_EXPFUNC double __stdcall GetDoublevalue(const double dpar) { printf("GetDoublevalue takes %.8lfn",dpar); return(dpar); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ MT4_EXPFUNC char* __stdcall GetStringValue(char *spar) { printf("GetDoublevalue takes "%s"n",spar); return(spar); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ MT4_EXPFUNC double __stdcall GetArrayItemValue(const double *arr,const int arraysize,const int nitem) { //---- if(arr==NULL) { printf("GetArrayItemValue: NULL arrayn"); return(0.0); } if(arraysize |
打赏
最新创建圈子
- 新闻EA运行效果图圈 2019-05-05
圈主:admin 帖子:1