How to secure MQL4 source code using the extern dll file ? - page 2

 
gordon:

If it's an MQL4 library - MetaEditor. If it's a DLL, then it depends on the programming-language, OS and on your IDE/Compiler of choice...


Ok, but if I use external compiler and other language than MQL4, then how to properly add that code to MQL program and compile FULL THE EXPERT ADVISOR ???

With what languages/compilers is the MQL4 compatible ? How to compact/compile more than one programming-language in the MQL4 EDITOR ???

 
puncher:


Ok, but if I use external compiler and other language than MQL4, then how to properly add that code to MQL program and compile FULL THE EXPERT ADVISOR ???

With what languages/compilers is the MQL4 compatible ? How to compact/compile more than one programming-language in the MQL4 EDITOR ???

I recommend u open the DLL example that comes with every Terminal installation in '\MT4\experts\samples\':

  • Source code for the DLL is in the 'DLLSample' folder.
  • Compiled DLL is in the 'libraries' folder.
  • The include file (that contains function prototypes) is in the 'include' folder.
  • Main program (written in MQL4) is in the main 'samples' folder.
Study the example well and u will get answers to most of your questions.
 
gordon:

I recommend u open the DLL example that comes with every Terminal installation in '\MT4\experts\samples\':

  • Source code for the DLL is in the 'DLLSample' folder.
  • Compiled DLL is in the 'libraries' folder.
  • The include file (that contains function prototypes) is in the 'include' folder.
  • Main program (written in MQL4) is in the main 'samples' folder.
Study the example well and u will get answers to most of your questions.


Is there any other expressions for standard MQL functions when I compile them as the library DLL file ?

And the other one question: Do you know what for are MQH files ?

 
puncher:

Is there any other expressions for standard MQL functions when I compile them as the library DLL file

I don't understand the question. The DLL is NOT written in MQL...


And the other one question: Do you know what for are MQH files ?

Those are the include files, see here -> https://docs.mql4.com/basis/preprosessor/include.

In this case, they should have an #import statement for the DLL or MQL4 Library and function prototypes for the imported functions. From your main mq4 file, u need to add a #include to the mqh file and then all functions will be available in your program.

Additionally, mqh files can be used to break up big programs into several files for convenience.
 
gordon:

I don't understand the question. The DLL is NOT written in MQL...


How to prepare DLL file? What application should I use in order to make DLL file from MQ4 file containing functions I'll use in EA?


Those are the include files, see here -> https://docs.mql4.com/basis/preprosessor/include.

In this case, they should have an #import statement for the DLL or MQL4 Library and function prototypes for the imported functions. From your main mq4 file, u need to add a #include to the mqh file and then all functions will be available in your program.

Additionally, mqh files can be used to break up big programs into several files for convenience.
 
gordon:
Those are the include files, see here -> https://docs.mql4.com/basis/preprosessor/include.

In this case, they should have an #import statement for the DLL or MQL4 Library and function prototypes for the imported functions. From your main mq4 file, u need to add a #include to the mqh file and then all functions will be available in your program.

Additionally, mqh files can be used to break up big programs into several files for convenience.

gordon,

I don't have any examples handy, but I remembered encountering problems when including 'includes'...

such as functions, if I create parameters with type declaration. compiler shows variables already defined, but if I don't then the include doesn't compile.

question : how do you break up programs with include properly ?

 
cameofx:

such as functions, if I create parameters with type declaration. compiler shows variables already defined, but if I don't then the include doesn't compile.

question : how do you break up programs with include properly ?

MQL4 doesn't have namespaces; you have to make sure that there are no variable/function name conflicts (on global scope). Minimizing the amount of global variables is a good idea in this regard.

For a complete example of how to break a large program into include files, see here -> https://book.mql4.com/build/index

 
gordon:

MQL4 doesn't have namespaces; you have to make sure that there are no variable/function name conflicts (on global scope). Minimizing the amount of global variables is a good idea in this regard.

For a complete example of how to break a large program into include files, see here -> https://book.mql4.com/build/index

Thanks for your prompt reply,

I've been avoiding this subject for some time..

somewhat related to the topic, we have the tools, include, library, File_Write and DLL.

Is it a good step to accustom using File functions or DLL to break up programs ; and skip include and library altogether ?

 
cameofx:

Thanks for your prompt reply,

I've been avoiding this subject for some time..

somewhat related to the topic, we have the tools, include, library, File_Write and DLL.

I don't understand what u mean by File_Write or File functions...? What does that have to do with the other 3 tools?


Is it a good step to accustom using File functions or DLL to break up programs ; and skip include and library altogether ?

I wouldn't use DLL's or libraries to break up programs. That makes no sense (IMHO). 'Include' files are the way to go if that's your main aim. DLL's and libraries have other uses...
 
Right, thank you for your explanations. I'm new in this subject... so please bear with me :)
I have a program in mind with some following requirements, for example :

Data Part :
- I need to poll market characteristics for instance price behavior on sessions, speed activity, breakout, etc -- It's not effecient to do that with buffers right ?
so, It's logical to use FileWrite functions ( or not? ) and keep data in txt or csv files.

Events Part :
- We use mql EA for this, event's and conditions are generated by ticks, broker and user.

Function Part :
- In my mind, EA can call hundreds of functions. It's not efficient to keep this in EA; so function modules should be used.
which is more efficient ?
- I will do some research, but if you would indulge me : When or where does DLL comes to play ?
Reason: