Back: libltdl Configury
Forward: libltdl Module Loader
 
FastBack: libltdl Module Loader
Up: Using libltdl
FastForward: Portable Library Design
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

18.2.2 Memory Management

Internally, libltdl maintains a list of loaded modules and symbols on the heap. If you find that you want to use it with a project that has an unusual memory management API, or if you simply want to use a debugging `malloc', libltdl provides hook functions for you to set the memory routines it should call.

The way to use these hooks is to point them at the memory allocation routines you want libltdl to use before calling any of its API functions:

 
    lt_dlmalloc = (lt_prt_t (*) PARAMS((size_t))) mymalloc;
    lt_dlfree   = (void (*) PARAMS((lt_ptr_t))) myfree;

Notice that the function names need to be cast to the correct type before assigning them to the hook symbols. You need to do this because the prototypes of the functions you want libltdl to use will vary slightly from libltdls own function pointer types-- libltdl uses lt_ptr_t for compatibility with K&R compilers, for example.


This document was generated by Joost van Baal on August, 23 2005 using texi2html