![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello MQL5 Community,
I have some questions regarding the use of DLLs during multi-threaded backtesting in MetaTrader 5, based on the documentation I found:
Multiple Instances: From the documentation, it seems that if a DLL is already loaded (even by another Expert Advisor or client terminal), it will be shared rather than creating multiple instances. Can someone confirm if this understanding is correct? How does this affect thread safety, especially when the same DLL functions are called from multiple threads?
Synchronization: Since DLL functions are executed in the thread of the calling module, and synchronization is not managed by the MetaTrader backtesting engine, what are the best practices for handling synchronization within the DLL? Specifically, how can I ensure that shared resources are accessed safely and efficiently in a multi-threaded environment?
Any insights, experiences, or best practices on managing DLL usage and ensuring thread safety during backtesting would be greatly appreciated.
Thank you!
Best regards,
Ramzi