Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > My DLL wants to close the program in which it's running

Reply
Thread Tools

My DLL wants to close the program in which it's running

 
 
Robert Rollins
Guest
Posts: n/a
 
      07-10-2007
Hi all,
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.

 
Reply With Quote
 
 
 
 
red floyd
Guest
Posts: n/a
 
      07-10-2007
Robert Rollins wrote:
> Hi all,
> 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.
>


Wrong group. The C++ Standard (ISO/IEC 14882:2003) doesn't discuss
DLLs. Try a group with windows or microsoft in the name. See FAQ 5.9

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

 
Reply With Quote
 
 
 
 
Herhor
Guest
Posts: n/a
 
      07-10-2007
Dnia 10-07-2007 o 07:36:21 red floyd <(E-Mail Removed)> napisa³(a):

> Robert Rollins wrote:
>> Hi all,
>> 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.
>>

>
> Wrong group. The C++ Standard (ISO/IEC 14882:2003) doesn't discuss
> DLLs. Try a group with windows or microsoft in the name. See FAQ 5.9
>
> http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
>


Yes, but let's not be so orthodox like C-ircusians!

 
Reply With Quote
 
BobR
Guest
Posts: n/a
 
      07-10-2007

red floyd <(E-Mail Removed)> wrote in message...
> Robert Rollins wrote:
> > Hi all,
> > I'm writing some additions to an existing C++ DLL,

[snip]
> >

>
> Wrong group. The C++ Standard (ISO/IEC 14882:2003) doesn't discuss
> DLLs. Try a group with windows or microsoft in the name. See FAQ 5.9
>
> http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
>


But Red, I thought a 'Doubly Linked List' (std::list) WAS on topic here. <G>

--
Bob R
POVrookie


 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      07-10-2007
BobR wrote:
> red floyd <(E-Mail Removed)> wrote in message...
>> Robert Rollins wrote:
>>> Hi all,
>>> I'm writing some additions to an existing C++ DLL,

> [snip]
>> Wrong group. The C++ Standard (ISO/IEC 14882:2003) doesn't discuss
>> DLLs. Try a group with windows or microsoft in the name. See FAQ 5.9
>>
>> http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
>>

>
> But Red, I thought a 'Doubly Linked List' (std::list) WAS on topic here. <G>
>


From the OP:
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.


Where do you see "Doubly Linked List"? How to kill a process from
within a DLL is OT.

 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      07-10-2007
BobR wrote:
>
> But Red, I thought a 'Doubly Linked List' (std::list) WAS on topic here. <G>
>


DOH!!!!! Ignore my other reply to this. I missed the "<g>" marker
Good one!

 
Reply With Quote
 
BobR
Guest
Posts: n/a
 
      07-10-2007

red floyd <(E-Mail Removed)> wrote in message...
> BobR wrote:
> >
> > But Red, I thought a 'Doubly Linked List' (std::list) WAS on topic here.

<G>
> >

>
> DOH!!!!! Ignore my other reply to this. I missed the "<g>" marker
> Good one!
>


Imagine the confusion we could create if every time some poor guy asks about
a window$ DLL in this NG, we *wedge* in a 'std::list' answer. :-}

I started to answer the OP with something like, "no, you don't need to use
exit(), just let the instantiation go out of scope.". But.....

--
Bob R
POVrookie


 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      07-11-2007
On Jul 10, 2:43 am, Robert Rollins <(E-Mail Removed)> 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.


There are only two standard ways to normally terminate a
process: return from main, and call exit(). (There's also
abort(), but I don't think we can consider that "normally
terminating".) Generally, it's better to avoid calling exit(),
since that means that the destructors of local variables aren't
called, but unless the main routine has provided for some other
conventions, there's not much else you can do. (In a number of
my programs, I use the convention of throwing an int; main
catch'es the int, and returns the value thrown. But this only
works because main() establishes the convention.)

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...

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      07-11-2007
James Kanze wrote:
> On Jul 10, 2:43 am, Robert Rollins <(E-Mail Removed)> 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.
 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      07-11-2007
red floyd wrote:

> James Kanze wrote:
>> On Jul 10, 2:43 am, Robert Rollins <(E-Mail Removed)> 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.


I would hope that the behavior of exit() when called from within a DLL
(whatever that may be) is not any different from what the standard has to
say about the behavior of exit() when called; otherwise the implementation
would seem to be non-conforming. Therefore, I do not see, how the answer to
the question depends on the DLL-issue.

As far as I can see, the OP mentioned DLLs just to indicate that he was
prepared to hear that, from within DLLs, there are special rules. That the
standard does not provide those rules does not render the question
off-topic but just allows for a simpler answer.


Best

Kai-Uwe Bux
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a TCP socket? (TCPSocket#close doesn't close it) Iñaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
popup if user wants to close window or enter another url libsfan01 Javascript 4 08-05-2006 10:01 PM
WinXP "Windows Explorer has encountered a problem and needs to close...." Shell32.dll and ntdll.dll question. Sparky Computer Support 3 01-24-2004 11:53 AM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM
Re: Confirm user wants to close browser window Jerry III ASP .Net 2 08-03-2003 12:53 PM



Advertisments