forked from Mirrors/liballoc
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
Plaintext
59 lines
1.2 KiB
Plaintext
|
|
|
|
|
|
There are 4 functions which you need to implement on your system:
|
|
|
|
int liballoc_lock();
|
|
int liballoc_unlock();
|
|
void* liballoc_alloc(int);
|
|
int liballoc_free(void*,int);
|
|
|
|
1) Have a look at liballoc.h for information about what each function is
|
|
supposed to do.
|
|
|
|
|
|
2) Have a look at linux.c for an example of how to implement the library
|
|
on linux.
|
|
|
|
|
|
NOTE: There are two ways to build the library.
|
|
|
|
1) Compile the library with a new system file. For example, I've
|
|
left linux.c with the default distribution. It gets compiled
|
|
directly into the liballoc_linux.so file.
|
|
|
|
2) Implement the functions in your application and then just
|
|
link against the default liballoc.so library when you compile
|
|
your app.
|
|
|
|
|
|
QUICK START
|
|
-------------
|
|
|
|
You can simply type: "make linux" to build the linux shared
|
|
library. Thereafter, you can link it directly into your applications
|
|
during build or afterwards by export the LD_PRELOAD environment
|
|
variable.
|
|
|
|
|
|
To run bash with the library, for example:
|
|
|
|
LD_PRELOAD=/full/path/to/liballoc.so bash
|
|
|
|
|
|
The above command will pre-link the library into the application,
|
|
essentially replacing the default malloc/free calls at runtime. It's
|
|
quite cool.
|
|
|
|
|
|
|
|
Durand Miller
|
|
|
|
clutter@djm.co.za
|
|
|
|
|
|
|
|
|
|
|
|
|