Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Тест из MT5
struct Quotes
{
char Symb[16];
double bid;
double ask;
double last;
double open;
double high;
double low;
double close;
long volume;
long tickVolume;
int timeFrame;
unsigned long DT;
};
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
struct TOrders_ans
{
char Symb[16];
double SL,TP,Order;
int lot;
int filler;
};
N 0 14:51:05.120 test_dll (EURUSD,M30) Cpp_callRobot returned true
OE 0 14:51:05.121 test_dll (EURUSD,M30) SoS data || SL: 2.0 || TP: 3.0 || Order: 1.0 || lot: 0
MI 0 14:51:05.121 test_dll (EURUSD,M30) SoS data || SL: 3.0 || TP: 4.0 || Order: 2.0 || lot: 1
KM 0 14:51:05.121 test_dll (EURUSD,M30) SoS data || SL: 4.0 || TP: 5.0 || Order: 3.0 || lot: 2
orders[i].Symb[0]='S';
orders[i].Symb[1]='o';
orders[i].Symb[2]='S';
orders[i].Symb[3]=' ';
orders[i].Symb[4]='\0';
Мой вариант для MT5(64 бита).
Структуры в VS под x64 выравниваются к размеру указателя, т.е. 8 байт, а в MQL выравнивание всегда 1 байт. Поэтому в MQL5 структурах добавлены вставки int _align.
.h
.cpp
.mq5
Структуры в VS под x64 выравниваются к размеру указателя, т.е. 8 байт, а в MQL выравнивание всегда 1 байт. Поэтому в MQL5 структурах добавлены вставки int _align.
#pragma pack(1)
https://www.mql5.com/ru/docs/basis/types/classes
Да, вы правы. Можно и не усложнять.
для скорости на стороне длл?
Для простоты. На скорость думаю влияет слабо
для скорости на стороне длл?
Этот приём со вставками используется для работы с Windows API. Т.к. эти DLL скомпилированы без директивы #pragma pack(1).
Для простоты. На скорость думаю влияет слабо
тем не менее подавляющее большинство кодеров предпочитают оптимизировать структуры чтобы в них не было дырок не убирая выравнивание, чем использовать pragma pack 1
Получаете еще большее усложнение кода (добавляется _WIN64)