Re: My DLL wants to close the program in which it's running
On Jul 11, 5:25 pm, red floyd <no.s...@here.dude> wrote:
James Kanze wrote:
On Jul 10, 2:43 am, Robert Rollins <coredumper...@gmail.com> wrote:
I'm writing some additions to an existing C++ DLL, and one of the
things I need to add is a generic way to close down the program in
which my DLL is running (so I can close down whatever program may have
loaded it). Can I just call exit(0)? That seems like a really
dramatic way to go about this, and I'm thinking that it might be a bad
idea. Any advice would be greatly appreciated.
[redacted]
BTW: you can ignore the idiots complaining about off topic.
Your question is quite appropriate here. But some people just
like to hear themselves talk, and since they can't think of
anything else...
No, James, I don't believe it's appropriate. Usage of exit() is
definitely on topic. But the behavior of exit() when called from a DLL
is specifically off topic.
If the behavior were platform specific, agreed. It's not.
Discussing details of a specific platform API is off topic, but
talking about generally available features, like dynamic
linking, are not off topic per se. Neither would be comparing
implementations, or discussing what will be in the next version
of the standard. Just because the symbol DLL happened to be in
the posting doesn't make it off topic.
The C++ standard actually tries to take DLL's into account, in
one place (order of initialization). I don't think it really
succeeds, and I don't think it should have, without completely
addressing the issue.
Note too that implicit dynamic linking is actually standard
conformant, today. The standard doesn't say when the final
phase of translation takes place, and as long as the the
observable behavior is conform with what is required by the
standard for the source code, an implementation can defer
linking as long as it likes.
--
James Kanze (Gabi Software) email: james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34