MQL5: Unable to load DLL despite adding it to /Libraries

MQL5: Unable to load DLL despite adding it to /Libraries

Manage alerts

Loading saved threads...

Fares · External communityPost link
External question — Stack Overflow Stack Exchange Author: Fares Original post: https://stackoverflow.com/questions/79628691 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I've created a DLL that more or less looks like this: #pragma once #ifdef _WIN32 #ifdef ZMQL_EXPORTS #define ZMQL_EXPORT extern "C" __declspec(dllexport) #else #define ZMQL_EXPORT extern "C" __declspec(dllimport) #endif #define ZMQL_CALL __stdcall #else #define ZMQL_EXPORT extern "C" #define ZMQL_CALL #endif #include <stddef.h> // Function declarations ZMQL_EXPORT int ZMQL_CALL init_zmq(wchar_t* endpoint); I've added it to my /Libraries folder: Directory: C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Libraries Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 5/19/2025 1:18 PM 36352 ZMQL.dll I arrived to the above location by right clicking MetaEditor and "Open Folder" I created my EA: #import "ZMQL.dll" int init_zmq(string endpoint); int zmq_publish(string topic, string message); void destroy_zmq(); #import input string Endpoint = "tcp://127.0.0.1:5555"; // Default ZMQ endpoint input string Topic = "TOPIC2"; // Default topic //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Print("---------------Init...----------"); int init_result = init_zmq(Endpoint); //if (init_result != 0) { // Print("Failed to initialize ZMQ! Error: ", init_result); //return(INIT_FAILED); //} Print("ZMQ initialized successfully."); //--- return(INIT_SUCCEEDED); And it builds fine. The problem comes when I run the MQL5 debugger: Critical error while running expert 'test1 (EURUSD,D1)'. Unknown error. If I choose to run it anyway, and use the MT5 strategy tester, I get the following output: 2025.05.19 13:49:44.358 login (build 4885) 2025.05.19 13:49:44.370 9148 bytes of account info loaded 2025.05.19 13:49:44.370 1478 bytes of tester parameters loaded 2025.05.19 13:49:44.370 1220 bytes of input parameters loaded 2025.05.19 13:49:44.407 40959 bytes of symbols list loaded (10724 symbols) 2025.05.19 13:49:44.407 expert file added: Experts\Advisors\Tests\ZMQL\test1.ex5. 11015 bytes loaded 2025.05.19 13:49:44.408 file added: Libraries\ZMQL.dll. 36374 bytes loaded 2025.05.19 13:49:44.427 11456 Mb available, 143 blocks set for ticks generating 2025.05.19 13:49:44.427 initial deposit 100000.00 USD, leverage 1:100 2025.05.19 13:49:44.429 successfully initialized 2025.05.19 13:49:44.429 79 Kb of total initialization data received 2025.05.19 13:49:44.429 12th Gen Intel Core i9-12900K, 32509 MB 2025.05.19 13:49:44.451 debug version of 'test1.ex5', please recompile it 2025.05.19 13:49:44.463 EURUSD: symbol to be synchronized 2025.05.19 13:49:44.464 EURUSD: symbol synchronized, 3720 bytes of symbol info received 2025.05.19 13:49:44.464 EURUSD: history synchronization started 2025.05.19 13:49:44.466 EURUSD: load 27 bytes of history data to synchronize in 0:00:00.001 2025.05.19 13:49:44.466 EURUSD: history synchronized from 2023.01.02 to 2025.05.16 2025.05.19 13:49:44.486 EURUSD,Daily: history cache allocated for 359 bars and contains 345 bars from 2024.01.02 00:00 to 2025.04.29 00:00 2025.05.19 13:49:44.486 EURUSD,Daily: history begins from 2024.01.02 00:00 2025.05.19 13:49:44.486 EURUSD,Daily (MetaQuotes-Demo): every tick generating 2025.05.19 13:49:44.486 EURUSD,Daily: testing of Experts\Advisors\Tests\ZMQL\test1.ex5 from 2025.04.30 00:00 to 2025.05.19 00:00 started with inputs: 2025.05.19 13:49:44.486 Endpoint=tcp://127.0.0.1:5555 2025.05.19 13:49:44.486 Topic=TOPIC2 2025.05.19 13:49:44.503 2025.04.30 00:00:00 cannot load 'C:\Users\user\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Experts\Advisors\Tests\ZMQL\ZMQL.dll' [126] 2025.05.19 13:49:44.503 2025.04.30 00:00:00 ---------------Init...---------- 2025.05.19 13:49:44.503 2025.04.30 00:00:00 cannot call 'int ZMQL::init_zmq(string)', module 'ZMQL.dll' is not loaded 2025.05.19 13:49:44.503 2025.04.30 00:00:00 unresolved import function call in 'test1.mq5' (1,1) 2025.05.19 13:49:44.503 OnInit critical error 2025.05.19 13:49:44.503 tester stopped because OnInit failed 2025.05.19 13:49:44.503 log file "C:\Users\user\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20250519.log" written 2025.05.19 13:49:44.503 test Experts\Advisors\Tests\ZMQL\test1.ex5 on EURUSD,Daily thread finished 2025.05.19 13:49:44.510 prepare for shutdown 2025.05.19 13:49:44.510 shutdown finished Worth noting: I've made sure DLLs are allowed on MT5. My DLL VCPKG triplet target is : x64-windows-static-md .
Quote
Report

Post Reply

Checking account access…
MQL5: Unable to load DLL despite adding it to /Libraries | Forex.com.bd