Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hi,
I made one dll that try call some function from metatrader platform.:
 
 
#define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <vector>
#include <iostream>
#include <cstring>

using namespace std;
//---
#define MT4_EXPFUNC __declspec(dllexport)
 
struct MqlStr
  {
   int               len;
   char             *string;
  };
 
  vector<char*> hsymbol;
  vector<char*> hcomment;
  vector<double>hsl;
  vector<double>htp;
  vector<double>hopenprice;
  vector<double>hcloseprice;
  vector<int>hticket;
  vector<int>hopentime;
  vector<int>hclosetime;
  vector<int>hordertype;
  vector<int>hmagic;
  vector<double>horderprofit;
 
  int htotal=0;
 
  
 

MT4_EXPFUNC void __stdcall history(double *h_tp,double *h_sl,int *h_ticket,double *h_openprice,
	double *h_closeprice,int *h_opentime,int *h_closetime,int *h_ordertype, MqlStr *h_symbol,
	MqlStr *h_comment,int *h_magic,double *h_orderprofit, int hordertotal)
  {
	  htotal=hordertotal;
	  
	
	   hsymbol.clear();
  hcomment.clear();
  hsl.clear();
  htp.clear();
  hopenprice.clear();
  hcloseprice.clear();
  hticket.clear();
  hopentime.clear();
  hclosetime.clear();
  hordertype.clear();
  hmagic.clear();
  horderprofit.clear();
	
  hsymbol.resize(htotal);
  hcomment.resize(htotal);;
  hsl.resize(htotal);
  htp.resize(htotal);
  hopenprice.resize(htotal);
  hcloseprice.resize(htotal);
  hticket.resize(htotal);
  hopentime.resize(htotal);
  hclosetime.resize(htotal);
  hordertype.resize(htotal);
  hmagic.resize(htotal);
  horderprofit.resize(htotal);
	  
 
  
  for(int i=0;i<htotal;i++){
  htp[i]=h_tp[i];
  hopenprice[i]=h_openprice[i];
  hcloseprice[i]=h_closeprice[i];
  hticket[i]=h_ticket[i];
  hopentime[i]=h_opentime[i];
  hclosetime[i]=h_closetime[i];
  hordertype[i]=h_ordertype[i];
  hmagic[i]=h_magic[i];
  horderprofit[i]=h_orderprofit[i];
 
  }
 
  
  return;
  }
 
 
When make dll I have not any errors.
 
After call function history get this error:
function 'history' call from dll 'Test.dll' critical error c0000005 at 61BB16EC.
 
This error is related to my code or any problem in my OS(win7)?
 
I tried using Fixed array variables instead vector but same error.
 
How I can fix this?
Regardsm
Posted 14-Oct-12 1:45am
Rezame951
Comments
Volynsky Alex at 14-Oct-12 10:45am
   
A C0000005 Error is a Windows System error. It is an Exception Error that occurs when a process (application, driver, etc.) tries to execute a processor command that references memory outside the space allocated to that process by the Operating System.
There are many possible causes ranging from corrupt data tables, to a bad network connection, ActiveX controls, or Printer or Video driver errors. WIthout knowing what type of error you are seeing, it is impossible to guess what the cause may be.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Richard MacCutchan 145
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,712
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 14 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100