blob: c53ad4acc50385d6b5194724adcbfb49076ab483 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/* -----------------------------------------------------------------------------
*
* (c) The GHC Team, 2009
*
* RTS Object Linker
*
* Do not #include this file directly: #include "Rts.h" instead.
*
* To understand the structure of the RTS headers, see the wiki:
* http://ghc.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
*
* ---------------------------------------------------------------------------*/
#ifndef RTS_LINKER_H
#define RTS_LINKER_H
#if defined(mingw32_HOST_OS)
typedef wchar_t pathchar;
#define PATH_FMT "ls"
#else
typedef char pathchar;
#define PATH_FMT "s"
#endif
/* 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
* frees 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 */
HsInt insertSymbol(pathchar* obj_name, char* key, void* data);
/* lookup a symbol in the hash table */
void *lookupSymbol( char *lbl );
/* delete an object from the pool */
HsInt unloadObj( pathchar *path );
/* add an obj (populate the global symbol table, but don't resolve yet) */
HsInt loadObj( pathchar *path );
/* add an arch (populate the global symbol table, but don't resolve yet) */
HsInt loadArchive( pathchar *path );
/* resolve all the currently unlinked objects in memory */
HsInt resolveObjs( void );
/* load a dynamic library */
const char *addDLL( pathchar* dll_name );
/* called by the initialization code for a module, not a user API */
StgStablePtr foreignExportStablePtr (StgPtr p);
#endif /* RTS_LINKER_H */
|