/* -----------------------------------------------------------------------------
- * $Id: Linker.c,v 1.42 2001/05/18 21:18:17 qrczak Exp $
+ * $Id: Linker.c,v 1.44 2001/06/22 12:35:28 rrt Exp $
*
* (c) The GHC Team, 2000
*
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) {
/* 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;
COFF_section* sectab_i
= (COFF_section*)
myindex ( sizeof_COFF_section, sectab, i );
- IF_DEBUG(linker, belchf("section name = %s\n", sectab_i->Name ));
+ IF_DEBUG(linker, belch("section name = %s\n", sectab_i->Name ));
#if 0
/* I'm sure this is the Right Way to do it. However, the