summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dl/dlfcn.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/dl/dlfcn.go b/dl/dlfcn.go
index f182cfe..eb40794 100644
--- a/dl/dlfcn.go
+++ b/dl/dlfcn.go
@@ -82,16 +82,12 @@ func Open(name string, flags Flag) (*Handle, error) {
}
// Look up a symbol, and return a pointer to it.
-//
-// This returns uintptr instead of unsafe.Pointer so that code using
-// dl cannot obtain unsafe.Pointers without importing the unsafe
-// package explicitly.
-func (h *Handle) Sym(symbol string) (uintptr, error) {
+func (h *Handle) Sym(symbol string) (unsafe.Pointer, error) {
h.l.RLock()
defer h.l.RUnlock()
if h.o == 0 {
- return 0, HandleClosedError
+ return nil, HandleClosedError
}
symbolC := C.CString(symbol)
@@ -100,9 +96,9 @@ func (h *Handle) Sym(symbol string) (uintptr, error) {
dlerror()
ptr := C.dlsym(h.c, symbolC)
if ptr == nil {
- return 0, dlerror()
+ return nil, dlerror()
}
- return uintptr(ptr), nil
+ return ptr, nil
}
// Close this handle on a shared object; decrementint the reference