Download MetaTrader 5

free the DLL

To add comments, please log in or register
Are you a good trader? Become a signals provider and make even more money!
kenykau
45
kenykau 2016.01.01 05:02 

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

Khurram Mustafa
27593
Khurram Mustafa 2016.01.01 20:18  
Outsource .dll are not allowed, Please contact service desk or moderators, they will guide you proper
kenykau
45
kenykau 2016.01.22 08:18  
Khurram Mustafa:
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

kenykau
45
kenykau 2016.01.22 08:33  

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

To add comments, please log in or register