1// Copyright 2015 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// +build !windows 6 7#include <stdint.h> 8#include <dlfcn.h> 9 10// Write our own versions of dlopen/dlsym/dlclose so that we represent 11// the opaque handle as a Go uintptr rather than a Go pointer to avoid 12// garbage collector confusion. See issue 23663. 13 14uintptr_t dlopen4029(char* name, int flags) { 15 return (uintptr_t)(dlopen(name, flags)); 16} 17 18uintptr_t dlsym4029(uintptr_t handle, char* name) { 19 return (uintptr_t)(dlsym((void*)(handle), name)); 20} 21 22int dlclose4029(uintptr_t handle) { 23 return dlclose((void*)(handle)); 24} 25 26void call4029(void *arg) { 27 void (*fn)(void) = arg; 28 fn(); 29} 30