summaryrefslogtreecommitdiff
path: root/libguile/guile.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-12-02 11:22:46 +0100
committerAndy Wingo <wingo@pobox.com>2011-12-02 11:57:25 +0100
commitb57bf2724a254cf73e255b3d2bca0a7dcad6674a (patch)
tree3cd2f3db68ebc8e81d8cbcb77cbec76abbf0253e /libguile/guile.c
parent738c899e4c1ab9d25cfbcd1010f34e0cce400bca (diff)
downloadguile-b57bf2724a254cf73e255b3d2bca0a7dcad6674a.tar.gz
install gmp memory functions that let libgc know about allocations
* libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc, custom_gmp_free): New static functions used by GMP for allocation. These are just wrappers for scm_malloc, scm_realloc, and free. (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero, use mp_set_memory_functions to configure GMP to use custom_gmp_{malloc,realloc,free} for memory allocation. (scm_bigprint): Ask gmp for the function used to deallocate the string returned by mpz_get_str. * libguile/numbers.h: Declare scm_install_gmp_memory_functions. * libguile/guile.c: When running the Guile binary, install the gmp_memory_functions. Based on a patch by Mark H Weaver <mhw@netris.org>.
Diffstat (limited to 'libguile/guile.c')
-rw-r--r--libguile/guile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libguile/guile.c b/libguile/guile.c
index 6da547b75..ac22b83df 100644
--- a/libguile/guile.c
+++ b/libguile/guile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,2000,2001, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,2000,2001, 2006, 2008, 2011 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -67,6 +67,7 @@ inner_main (void *closure SCM_UNUSED, int argc, char **argv)
int
main (int argc, char **argv)
{
+ scm_install_gmp_memory_functions = 1;
scm_boot_guile (argc, argv, inner_main, 0);
return 0; /* never reached */
}