473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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

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.

Jul 10 '07 #1
10 2531
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

Jul 10 '07 #2
Dnia 10-07-2007 o 07:36:21 red floyd <no*****@here.dudenapisa³(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! ;)

Jul 10 '07 #3

red floyd <no*****@here.dudewrote 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
Jul 10 '07 #4
BobR wrote:
red floyd <no*****@here.dudewrote 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.

Jul 10 '07 #5
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!

Jul 10 '07 #6

red floyd <no*****@here.dudewrote 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
Jul 10 '07 #7
On Jul 10, 2:43 am, Robert Rollins <coredumper...@gmail.comwrote:
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:ja*********@gmail.com
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

Jul 11 '07 #8
James Kanze wrote:
On Jul 10, 2:43 am, Robert Rollins <coredumper...@gmail.comwrote:
> 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.
Jul 11 '07 #9
red floyd wrote:
James Kanze wrote:
>On Jul 10, 2:43 am, Robert Rollins <coredumper...@gmail.comwrote:
>> 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
Jul 11 '07 #10
Kai-Uwe Bux wrote:
red floyd wrote:
>James Kanze wrote:
>>On Jul 10, 2:43 am, Robert Rollins <coredumper...@gmail.comwrote:
[redacted]
>>>
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.
OK, I'll concede the point. Sorry if I came off as a bit of a pig.

Jul 11 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I...
27
by: xeys_00 | last post by:
I'm a manager where I work(one of the cogs in a food service company). The boss needed one of us to become the "tech guy", and part of that is writing small windows programs for the office. He...
5
by: Yoav | last post by:
I use the following code to the console output: def get_console(cmd): try: p_in, p_out, p_err = os.popen3(cmd) except: pass out_str = '' for obj in p_out: out_str = out_str + obj
14
by: vbMark | last post by:
First this runs: static void Main() { ///////////////////// /// Don't let app run more than one instance. /// Process aProcess = Process.GetCurrentProcess();
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
0
by: Steve Ingram | last post by:
Found out what I'd done, and it wasn't py2exe causug the problem. I wasn't closing the main dialog properly, I was calling Close() instead of Destroy(), so the dialog stayed in memory, basically it...
5
by: kimiraikkonen | last post by:
I made a very small (2 forms) application with VB.NET 2005 express and second form contains web-browser component and flash movie inside it. Everything OK but after i close the program via normal...
5
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of...
2
by: Bassem | last post by:
I'm working on simple chat program via serial port. It works fine, but i face this problem. When i try to open the exe, UnauthorizedAccess exception occurs, i can't use COM1 becuase someone else has...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.