If you have compiled function, you can call it form any language. For example, you able to create EasyLanguage strategy that will use MQL4 and PTL indicators and functions written in any supported language.
You also can import functions from operating system modules (*.dll files) as well, as from user-defined functions. The module name is specified in the #import directive.
You should place the .dll files into the following directory of the .NET Station: "C:\Program Files\ .NET Station\Include\"
If you want to use dlls from the Windows directory (for example user32, kernel32, winmm, etc) PTL Builder can find it automatically, so you shouldn't to copy it.
For compiler to be able to form the imported function call and pass parameters in a proper way, the full description of functions is needed. Functions descriptions follow the #import "module name" immediately.
Imported functions must have their unique names. Functions having the same names cannot be imported simultaneously from different modules. Imported functions names may not coincide with those of built-in functions.
Since the imported functions are out of the module to be compiled, the compiler cannot check correctness of parameters passed. This is why, to avoid runtime errors, it is necessary to declare the compliance of types and order of parameters precisely. The parameters passed to imported functions cannot have values by default.
For importing of functions during execution of the program, the so-called late binding is used. This means that until the imported function has not been called, the corresponding module (dll) will not be loaded.
Comments