github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/runtime/dlopen/dlopen.go (about)

     1  package dlopen
     2  
     3  import (
     4  	"fmt"
     5  	"unsafe"
     6  
     7  	"github.com/gotranspile/cxgo/runtime/libc"
     8  )
     9  
    10  // TODO: set correct values
    11  const (
    12  	RTLD_LAZY = 1 << iota
    13  	RTLD_NOW
    14  	RTLD_GLOBAL
    15  	RTLD_LOCAL
    16  )
    17  
    18  type Library struct {
    19  	name string
    20  }
    21  
    22  var gerr error
    23  
    24  func Open(name string, flags int) *Library {
    25  	// FIXME: dlopen
    26  	panic(fmt.Errorf("dlopen(%q, 0x%x)", name, flags))
    27  }
    28  
    29  func (l *Library) Sym(name string) unsafe.Pointer {
    30  	// FIXME: dlsym
    31  	panic(fmt.Errorf("dlsym(%q)", name))
    32  }
    33  
    34  func (l *Library) Close() int {
    35  	return 0
    36  }
    37  
    38  func Error() *byte {
    39  	if gerr == nil {
    40  		return nil
    41  	}
    42  	return libc.CString(gerr.Error())
    43  }