473,513 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Module: Destructor/Cleanup Code/etc

How do I register a clean up function for a module written in C? While
I can find plenty of documentation for the "init<module_name>"
function... I don't see a single reference on a "done<module_name>" or
something analogous.

Obviously if I can't get code to run in closing time, then the
usefulness is far less (I mean, surely there is a recognition that
some modules will need to clean up after themselves.)

Dylan.
Jul 18 '05 #1
1 2405
Dylan Shell wrote:
How do I register a clean up function for a module written in C? While
I can find plenty of documentation for the "init<module_name>"
function... I don't see a single reference on a "done<module_name>" or
something analogous.


Call function register from standard library module atexit, passing it
the Python-callable function object you want to be called at exit,
and optionally positional and keyword arguments you want to be
used when that function is called. I.e., just like for a module written
in Python.
Alex

Jul 18 '05 #2

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

Similar topics

1
1392
by: Zahid Faizal | last post by:
I am extremely surprised that my C++ compiler does not invoke the destructor on dynamically created objects upon program termination. As part of the overall "cleanup" upon program termination I...
26
3946
by: pmizzi | last post by:
When i compile my program with the -ansi -Wall -pedantic flags, i get this warning: `class vechile' has virtual functions but non-virtual destructor, and the same with my sub-classes. But when i...
11
5263
by: Ken Durden | last post by:
I am in search of a comprehensive methodology of using these two object cleanup approaches to get rid of a number of bugs, unpleasantries, and cleanup-ordering issues we currently have in our...
1
1777
by: Carl J. Van Arsdall | last post by:
I'm extending Python with C, it seems as though initialization is easy enough with an init<moduleName>() function that all C extended python modules must provide that can serve as a sort of "module...
35
3271
by: Peter Oliphant | last post by:
I'm programming in VS C++.NET 2005 using cli:/pure syntax. In my code I have a class derived from Form that creates an instance of one of my custom classes via gcnew and stores the pointer in a...
23
2558
by: Ben Voigt | last post by:
I have a POD type with a private destructor. There are a whole hierarchy of derived POD types, all meant to be freed using a public member function Destroy in the base class. I get warning C4624....
10
459
by: piboye | last post by:
Hi ! I'm a academician in china. I have been intereted in C++ lasting. In reading the C++ Primer book, i have a trouble about union. In the book ,it said that union can have constructors and...
2
2538
by: Scott McFadden | last post by:
I have a C++ CLI Managed DLL project which is consumed by C# clients. What is the recommended way for ensuring proper clean up of managed resources and native resources in a managed C++ class? ...
3
1374
by: Juha Nieminen | last post by:
This is a simplified version of the situation (the actual situation is quite more complex, but when stripped to the bare minimum, it's like this): class BaseClass { public: virtual void...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.