Outsource .dll are not allowed, Please contact service desk or moderators, they will guide you proper
Hi Khurram,
I am not outsourcing dll file. I just wondering the mechanism of mt4 in releasing (free locking) the dll after calling the dll
Best wishes,
Ken
May I describe the problem in more specify way.
I have two ways to write the dll, one is use c++ dllmain (of course this is requiring more skills); another is to use c# unmanaged exports dll.
I observed that using c++ (dllmain), the life cycle of the dll seems like the following:
for example if I use my dll in expert in init()
Init() --> begin calling the dll --> (lock the dll file) dll computation --> (release the dll) --> complete Init()
after the dll call completed, DLL_PROCESS_DETACH is called.
I can delete the dll file after the init() is complete.
In C# the life cycle is different:
for example if I use my dll in expert in init()
Init() --> begin calling the dll --> (lock the dll file) dll computation --> complete Init() --> dll is still locked.
after unload the expert, dll still locked. The only way to completely unload the dll is to close the terminal.
I can delete the dll file after close the MT4.
I have googled that c# unmanaged exports do not have dllmain. May be that is the cause.
I use C# to write my dll, (more familiar with c#) as c# provide singleton more easily. (C++ also have singleton, but after the DLL_PROCESS_DETACH, no more single instance).
If there is anyone can have comments on the issue that creating c++ singleton in the dll consumed by MT4 would be great.
Wishes,
Ken
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
I wrote a dll function, so that I can extend mql4. But I found there is no way to release the dll file unless I close the terminal. This is not a big problem, but very annoying while developing and upgrading the dll.
Does anyone can provide a solution? Just like when the indicator and expert call DeInit function will also release the dll?
Best wishes and happy new years.
Ken