From: sewardj Date: Wed, 6 Jun 2001 14:03:41 +0000 (+0000) Subject: [project @ 2001-06-06 14:03:41 by sewardj] X-Git-Tag: Approximately_9120_patches~1795 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f7c5bff1799f69a1505da0d643fa79ad0d37f393;p=ghc-hetmet.git [project @ 2001-06-06 14:03:41 by sewardj] RTS-side stuff for making -L work on the ghci command line. --- diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index 7d49faa..105739a 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.42 2001/05/18 21:18:17 qrczak Exp $ + * $Id: Linker.c,v 1.43 2001/06/06 14:03:41 sewardj Exp $ * * (c) The GHC Team, 2000 * @@ -439,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) { @@ -463,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; diff --git a/ghc/rts/Linker.h b/ghc/rts/Linker.h index 5ab3c64..c143062 100644 --- a/ghc/rts/Linker.h +++ b/ghc/rts/Linker.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.h,v 1.4 2001/02/14 11:02:36 sewardj Exp $ + * $Id: Linker.h,v 1.5 2001/06/06 14:03:41 sewardj Exp $ * * (c) The GHC Team, 2000 * @@ -23,4 +23,4 @@ HsInt loadObj( char *path ); HsInt resolveObjs( void ); /* load a dynamic library */ -char *addDLL( char *path ); +char *addDLL( char* path, char* dll_name );