Thread: Automatically executing method on library unload (gcc)

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    1

    Automatically executing method on library unload (gcc)

    Just a quick question (I hope).

    Is it possible to give gcc a directive/pragma to get it to run a cleanup function when a library is unloaded? This would be trivial in C++ - it would just be a destructor. Do I need to rewrite my code inside a class and use g++, or can I keep my code pure C and still manage this?

    Thanks for any advice.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Why don't you write the cleanup routine as part of the unload procedure?
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. Replies: 4
    Last Post: 09-02-2007, 08:47 PM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Problem calling external method from within a shared library
    By Major Tom in forum C++ Programming
    Replies: 0
    Last Post: 04-21-2007, 09:14 AM
  5. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM