MQL4 Reference Language Basics Functions Description of External Functions
|
Description of External FunctionsExternal functions defined in another module must be explicitly described. The description includes returned type, function name and series of input parameters with their types. The absence of such a description can lead to errors when compiling, building, or executing a program. When describing an external object, use the keyword #import indicating the module. Examples:
With the help of import, it is easy to describe functions that are called from external DLL or compiled EX4 libraries. EX4 libraries are compiled ex4 files, which have the library property. Only function described with the export modifier can be imported from EX4 libraries. Please keep in mind that DLL and EX4 libraries should have different names (regardless of the directories they are located in) if they are imported together. All imported functions have the scope resolution corresponding to the library's "file name". Use of several functions of the same name from different execution contexts in a program may cause ambiguity. To avoid the ambiguity of function calls, always explicitly specify the function scope using the scope resolution operation. Example:
See also Overload, Virtual Functions, Polymorphism |