summaryrefslogtreecommitdiff
path: root/dl
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-10-26 16:10:50 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-10-26 16:10:50 -0400
commit9a08b2758e86effcb70b92a31548d8368c95a7e6 (patch)
tree78ba08bab8074e35bac46d793d67332cd23fe6e8 /dl
parentf3a7f73359c43d57e6521b83f0dbbf4ca9466e6b (diff)
dlfcn: return raw unsafe.Pointer
Diffstat (limited to 'dl')
-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