how to unload the dll - page 6

 
VBAG писал(а) >>

Is the main function prototype selected correctly?

How to manage the ATTACH/DETACH threads?

Where to read about this and preferably with examples?

Jeffrey Richter "Windows for Professionals".

 
VBAG >> :

Greetings to all!

The topic got interesting and decided to check the discussed topic on a simple example that comes with the terminal (DLLSample project).

After compiling in VS 6.0, the baked dll works with the terminal successfully, but does not unload itself!


How do you know it's not unloading? My DLLSample works fine.

 
HideYourRichess писал(а) >>

How do you know it's not unloading? My DLLSample works fine.

Indirectly, the body of the dll file is not overwritten until you close the terminal.

.

I have a couple of static arrays declared at global level, maybe it affects it.

.

I want to understand how to tune the project correctly and "carefully" prescribe attach/detach as I put it.

 

Thank you, I'll be watching.

 
VBAG >> :

Greetings to all!

The topic got interesting and decided to check the discussed topic on a simple example that comes with the terminal (DLLSample project).

After compiling in VS 6.0, the baked dll works with the terminal successfully, but does not unload itself!

Here is the main function:

And now a question to connoisseurs, who really understand how the dll is and works under the Windows and know how to compile it correctly in a project under VS 6.0(for example).

Is the prototype of the main function correct?

How to manage streams ATTACH/DETACH?

Where can I read about it, preferably with examples?

What atach? What dtach? What are you talking about? The DllMain function in a regular dll is not needed at all! The linker inserts it into the dll instead of you.

http://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.80).aspx

/MD, /MT, /LD (Use Run-Time Library)


/LD

Creates a DLL.

Passes the /DLL option to the linker. The linker looks for, but does not require, a DllMain function. If you do not write a DllMain function, the linker inserts a DllMain function that returns TRUE.

Links the DLL startup code.


http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx

DllMain Callback Function

An optional entry point into a dynamic-link library (DLL)
 
VBAG >> :

Indirectly, the body of the dll file is not overwritten until you close the terminal.

.

However, I have a couple of static arrays declared at global level, maybe it affects it.


So you don't actually have a DLLSample, as you claimed earlier? right.

VBAG >> :

I want to understand how to tune the project correctly and "carefully" prescribe attach/detach as I put it.

 
HideYourRichess писал(а) >>

So you don't actually have DLLSample, as you claimed earlier? right.

Well, in general, yes, if you use explicitly DllMain. And in general, all project settings should be taken from the sampler. Megakvot recommends to prescribe DllMain explicitly, although if you write in Delphi you can not prescribe DllMain there and put all attach/detach into initialization and finalization.

Except I added two static arrays at global level, the whole project is taken from DLLSample.

I call the primitive function in the EA running in the tester. When testing is completed, the DLL is held in memory. Here is the situation.

 
VBAG >> :

Except I added two static arrays at global level, the whole project is taken from DLLSample.

I call the primitive function in the EA running in the tester. When testing is completed, the DLL is held in memory. Here is the situation.

Aha, so the problem occurs in the tester. It is not a script, and not an indicator - it is the Expert Advisor. Well, how does this EA behave under normal conditions, not in the tester?


By the way, "two static arrays at the global level" in theory should not affect the dll in any way. Especially if you don't use dll to access them at all.


Funny. Some of the text in my post is missing that you were replying to, even though I didn't delete it. The forum is glitchy.

 
HideYourRichess >> :

Aha, so the problem arises in the tester. And it's neither a script, nor an indicator - it's an EA. Well, how does this EA behave in normal, non-tester conditions?

Actually, I had all these problems with the dll a year ago as well, when I had EA-

checked my tester's run against the system one.

But... someone managed to put everyone down a few times about crooked hands and errors in the programme.

God forbid somebody to be such a boss :-(.

P.S.: polinked dll with VC 2005 runtime libraries: after indicator and script

>> everything unloads normally.

 
jartmailru >> :

Actually, I had all these problems with the dll a year ago as well, when I had EA-

checked my tester's run against the system one.

But... someone managed to put everyone down a few times about crooked hands and errors in the programme.

God forbid somebody to be such a boss :-(.

P.S.: Polinked dll with VC 2005 runtime libraries: after indicator and script

everything unloads fine.

Once again, I have no problems with the dll anywhere. If you have a problem, it is your programming problem, it is probably not MS or MT's fault. And the fact that you need to use "old" VC - that should be clear.