Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
801c4d28
Commit
801c4d28
authored
Feb 14, 2001
by
sewardj
Browse files
[project @ 2001-02-14 11:02:36 by sewardj]
Allow addDLL to return error message strings to caller.
parent
970b9e8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
ghc/rts/Linker.c
View file @
801c4d28
/* -----------------------------------------------------------------------------
* $Id: Linker.c,v 1.2
8
2001/02/1
3
1
8
:0
1:22 simonmar
Exp $
* $Id: Linker.c,v 1.2
9
2001/02/1
4
1
1
:0
2:36 sewardj
Exp $
*
* (c) The GHC Team, 2000
*
...
...
@@ -285,18 +285,27 @@ initLinker( void )
* lookupSymbol() will subsequently see them by dlsym on the program's
* dl-handle. Returns 0 if fail, 1 if success.
*/
int
char
*
addDLL
(
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
);
hdl
=
dlopen
(
buf
,
RTLD_NOW
|
RTLD_GLOBAL
);
hdl
=
dlopen
(
buf
,
RTLD_NOW
|
RTLD_GLOBAL
);
free
(
buf
);
return
(
hdl
==
NULL
)
?
0
:
1
;
if
(
hdl
==
NULL
)
{
/* dlopen failed; return a ptr to the error msg. */
errmsg
=
dlerror
();
if
(
errmsg
==
NULL
)
errmsg
=
"addDLL: unknown error"
;
return
errmsg
;
}
else
{
return
NULL
;
}
ASSERT
(
0
);
/*NOTREACHED*/
# elif defined(OBJFORMAT_PEi386)
barf
(
"addDLL: not implemented on PEi386 yet"
);
return
0
;
...
...
ghc/rts/Linker.h
View file @
801c4d28
/* -----------------------------------------------------------------------------
* $Id: Linker.h,v 1.
3
2001/02/1
3
1
8
:0
1:22 simonmar
Exp $
* $Id: Linker.h,v 1.
4
2001/02/1
4
1
1
:0
2:36 sewardj
Exp $
*
* (c) The GHC Team, 2000
*
...
...
@@ -23,4 +23,4 @@ HsInt loadObj( char *path );
HsInt
resolveObjs
(
void
);
/* load a dynamic library */
HsInt
addDLL
(
char
*
path
);
char
*
addDLL
(
char
*
path
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment