From 5874f13fd83409b28c4f781a93e80f4605d0593e Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 21 Nov 2013 12:27:27 +0000 Subject: Allow the linker to be used without retaining CAFs unconditionally This creates a new C API: initLinker_ (int retain_cafs) The old initLinker() was left as-is for backwards compatibility. See documentation in Linker.h. --- includes/rts/Linker.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h index ea4daebc8a..e7e2ea5ce5 100644 --- a/includes/rts/Linker.h +++ b/includes/rts/Linker.h @@ -22,8 +22,25 @@ typedef char pathchar; #define PATH_FMT "s" #endif -/* initialize the object linker */ -void initLinker( void ); +/* Initialize the object linker. Equivalent to initLinker_(1). */ +void initLinker (void); + +/* Initialize the object linker. + * The retain_cafs argument is: + * + * non-zero => Retain CAFs unconditionally in linked Haskell code. + * Note that this prevents any code from being unloaded. + * It should not be necessary unless you are GHCi or + * hs-plugins, which needs to be able call any function + * in the compiled code. + * + * zero => Do not retain CAFs. Everything reachable from foreign + * exports will be retained, due to the StablePtrs + * created by the module initialisation code. unloadObj + * free these StablePtrs, which will allow the CAFs to + * be GC'd and the code to be removed. + */ +void initLinker_ (int retain_cafs); /* insert a symbol in the hash table */ void insertSymbol(pathchar* obj_name, char* key, void* data); -- cgit v1.2.1