MQL5Book/Scripts/p2/ExternHeader1.mqh

36 lines
1.2 KiB
MQL5
Raw Permalink Normal View History

2025-05-30 16:09:41 +02:00
//+------------------------------------------------------------------+
//| ExternHeader1.mqh |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#ifdef USE_INCLUDE_WORKAROUND
// a replacement for extern variable could be:
#include "ExternCommon.mqh" // which contains:
//+------------------------------------------+
//| /* ExternCommon.mqh */ |
//| int x; |
//+------------------------------------------+
#else
extern int x;
#endif
// the following line would throw the error "unresolved extern variable 'y'",
// if 'y' is not defined anywhere else
extern long y;
short z;
//+------------------------------------------------------------------+
//| Mockup increment function using 'x' |
//+------------------------------------------------------------------+
void inc()
{
x++;
}
//+------------------------------------------------------------------+