Discussion on "How to write a DLL for MQL5 and exchange data in 10 minutes". - page 4

 
What is this message I am getting "2010.01.24 22:41:09 MQL5DLL_Test (GBPJPY,H4) Access violation write to 0x00000000 in 'D:\Soft\Forex\MetaTrader 5\MQL5\Libraries\MQL5DLLSamples.dll'?
MT5 build 240. Calling the dll is allowed.
 
joo:
What is this message I am getting "2010.01.24 22:41:09 MQL5DLL_Test (GBPJPY,H4) Access violation write to 0x00000000 in 'D:\Soft\Forex\MetaTrader 5\MQL5\Libraries\MQL5DLLSamples.dll'?
MT5 build 240. Calling dll is enabled.

Demo example from the article:

4. Exception catching in DLL functions

To avoid crashing the terminal itself, each DLL function call is automatically protected by an Unhandled Exception wrapper. This mechanism prevents most of the standard errors (invoking inaccessible memory, division by zero, etc.).

To check this mechanism's operability let's create the following code:

_DLLAPI void __stdcall fnCrashTest(int *arr)
  {
//--- ожидаем получение нулевой ссылки, чтобы вызвать исключение
   *arr=0;
  }

and call it from the terminal:

#import "MQL5DLLSamples.dll"
void fnCrashTest(int arr);
#import

//--- вызовем креш (среда исполнения перехватит исключение и не даст упасть терминалу)
   fnCrashTest(NULL);
   Print("Этого текста не увидите!");
//---

As a result there will be an attempt to write into zero address with an exception being generated. The terminal will intercept it, report in the log and continue its work:

MQL5DLL Test (GBPUSD,M1) 20:31:12 Access violation write to 0x00000000


 
Renat:
From the article a demonstration example:

Thank you. So I wasn't very attentive when I read the article. :)

PS I could have said something like, "Listen, comrade! Go reread the article again," and you'd be right. Respect and respect, as they say.

 
Renat:

Dear pisara,

Let's be clear - we are having an argument between a theorist and a practitioner.
Without getting personal, to the point. A good theorist relies on practical experience, a good practitioner measures seven times.

Of course, no one forbids you from fighting for "world peace", but take into account more factors than "why not improve?

That's what I wrote - you won't use it, because you don't want to do routine work. You will have to be given everything on a silver platter - all the indicators, all the market environment, all the history in different periods, etc. And you need to do charting, because you won't manipulate all the indicators in your mind.

So, you actually need a full-fledged terminal. And we give it to you: MetaTrader 5 + MQL5 + DLL. Call it a framework or just say - give us the terminal in source code/components (because this is what you're demanding).

It's not peacemaking here, but you have to agree that making life easier for the programmer and improving the quality of the trading system + its integration capabilities hasn't hurt anyone yet. Not far off examples: Borland Delphi, MS .net have a fully open framework / component base / class diagrams and even a significant part of the source code (Delphi) for platform users.

Programmers mistakenly consider it "powerful" to be able to write scripts for trading systems in unprotected native languages, and then are surprised that no one is even going to use their creations. That's why they die before they are born. Those who developed and created a community of users think much deeper (because they got the knocks before) and do not make such mistakes.
Let's be realistic. If you want to release a software and sell it, in six months or a year release a paid update, then code protection is very important to you. If you, as I understand it, are here for the long term and continuously improve the platform with a chain of builds and support, then no competitor will get you. But users will be able to write much better code. And not only the code, but also the TC structure, which is no less important! I can even bring an analogy with antiviruses - hacking the AV client does not yet give access to the virus database update (here - quotas).

Controlled (disabled by default) DLL call is acceptable, but downloading DLLs made by someone to your trading terminal is a hole that's worse than an unpatched Internet Explorer 6.
So this hole is just a user's permission! How can a poor user guarantee 100% absence of harmful DLL, even if it is signed by company X? After all, if he banned it in doubt, he would never know if it would be useful to him or not. So here we have some psychology.


For your information Google Trends statistics on trading terminals with automation:

I wonder if the scale of ordinates is logarithmic?
By the way, Russian data is interesting and we can see that red Metastock is leading:

Google Тренды - Сервис: Поиск по Интернету. Запросы не указаны. - По всему миру, 2004 – настоящее время
Google Тренды - Сервис: Поиск по Интернету. Запросы не указаны. - По всему миру, 2004 – настоящее время
  • www.google.ru
Изучайте популярные поисковые запросы при помощи службы "Google Тренды".
 

Use the regular "Reply" functions, please. It's very uncomfortable to read.

To break up a quoted block, put your cursor where you want it and select "Plain text" style or press Ctrl+1.


In general, I recommend that you stop with this kind of advice - it is fundamentally deadly, based on the wrong assumptions and not suitable for applied language.

As a joke, there's an old joke:

Сидят двое нищих. Перед каждым из них шляпа и надпись. У одного: «Подайте бедному еврею», у второго: «Подайте бедному арабу». Шляпа первого пуста, а в шляпе второго куча денег.

A passer-by approaches a Jew, throws in a ruble and says:

- Listen, change the sign, otherwise you'll stay hungry.

When the passer-by left, the Jew turned to his neighbour and said:

- Do you understand, Izya? This man is going to teach us about commerce!

 
Renat:

Use the regular "Reply" functions, please. It's very uncomfortable to read.

To break a quoted block, put your cursor in the right place and select "Plain text" style or press Ctrl+1.


Generally, I recommend you stop with this kind of advice - it's fundamentally killer, based on the wrong assumptions and not suitable for an applied language.

As a joke, there's an old joke:


OK, if you don't want to give the real reasons why the premise is killer and why the .net framework is cramped for you, discussion is over. Regarding the joke, measure for yourself, the monastery is yours.

Remains to wish everyone good luck not to look back after upgrading to 5.

 
Renat, thank you very much for the article! It is very interesting and informative. Unfortunately, I have not managed to use MQL5DLL Test.mq5 script. I did everything as described in the article. However, when I ran the script, MT5 just fell down. I do not know what the problem is. May it be the issue of axis? I am running MS Vista x64. Please advise how to fix it :-)
 
denkir:
Renat, thank you very much for the article! It is very interesting and informative. Unfortunately, I have not managed to use MQL5DLL Test.mq5 script. I did everything as described in the article. However, when I ran the script, MT5 just fell down. I do not know what the problem is. May it be the issue of axis? I am running MS Vista x64. Please advise how to fix it :-)

Read the whole article again, please.

There is just a place about error generation (writing into zero addresses) inside DLL, and further error catching by terminal without crash. It is necessary to comment out call of fnCrashTest method.

Today I will check this code on Vista x64 - may be it is our error.

 
Renat писал(а) :

Read the whole article again, please.

There is just a place about error generation (writing into zero addresses) inside DLL and further catching this error by terminal without crash. You should comment out call of fnCrashTest method.

Today I will check this code on Vista x64 - may be it is our error.

Yes, I have read everything carefully and more than once :-))

I forgot to tell you that I commented out fnCrashTest(int arr) function in MQL5DLL Test.mq5 script. I still get a crash. :-(

This is what it looks like. Or I have to comment out function fnCrashTest(int arr) in dll code?

=========================
#import "MQL5DLLSamples.dll"
int  fnCalculateSpeed(int &res1,double &res2);
void fnFillArray(int &arr[],int arr_size);
void fnReplaceString(string text,string from,string to);
//void fnCrashTest(int arr);
#import
=========================

//fnCrashTest(NULL);
//Print("Этого текста не увидите!");

 

1) which version of the terminal is 32 or 64 bit?

2) which version of dll is 32 or 64 bit?