[project @ 2001-06-06 14:03:41 by sewardj]
[ghc-hetmet.git] / ghc / rts / Linker.c
index e3782c1..105739a 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Linker.c,v 1.41 2001/05/16 09:40:11 sewardj Exp $
+ * $Id: Linker.c,v 1.43 2001/06/06 14:03:41 sewardj Exp $
  *
  * (c) The GHC Team, 2000
  *
@@ -153,6 +153,7 @@ typedef struct _RtsSymbolVal {
       Sym(stg_gc_f1)                           \
       Sym(stg_gc_ut_1_0)                       \
       Sym(stg_gc_ut_0_1)                       \
+      Sym(stg_gc_unpt_r1)                      \
       Sym(stg_gc_unbx_r1)                      \
       Sym(stg_chk_0)                           \
       Sym(stg_chk_1)                           \
@@ -438,15 +439,20 @@ static OpenedDLL* opened_dlls = NULL;
 
 
 char*
-addDLL ( char* dll_name )
+addDLL ( char* path, char* dll_name )
 {
 #  if defined(OBJFORMAT_ELF)
    void *hdl;
    char *buf;
    char *errmsg;
 
-   buf = stgMallocBytes(strlen(dll_name) + 10, "addDll");
-   sprintf(buf, "lib%s.so", dll_name);
+   if (path == NULL || strlen(path) == 0) {
+      buf = stgMallocBytes(strlen(dll_name) + 10, "addDll");
+      sprintf(buf, "lib%s.so", dll_name);
+   } else {
+      buf = stgMallocBytes(strlen(path) + 1 + strlen(dll_name) + 10, "addDll");
+      sprintf(buf, "%s/lib%s.so", path, dll_name);
+   }
    hdl = dlopen(buf, RTLD_NOW | RTLD_GLOBAL );
    free(buf);
    if (hdl == NULL) {
@@ -462,7 +468,7 @@ addDLL ( char* dll_name )
 
    /* Add this DLL to the list of DLLs in which to search for symbols.
       The first time through, also add the executable to the list,
-      since we need to search that too. */
+      since we need to search that too.  The path argument is ignored. */
    char*      buf;
    OpenedDLL* o_dll;
    HINSTANCE  instance;