variadic

package module
v0.0.0-...-710a4c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2013 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Package variadic
================

This packge implements variadic calling conventions for calling foreign C code from within Go.

The primary motivation for this package was to be able to interface with Apple's Objective-C
runtime on Mac OS X, which uses a variadic function (objc_msgSend) for sending messages to objects.

Status
======

amd64:  Works pretty well - http://github.com/mkrautz/objc uses it (only tested on darwin, though!)

386:    Works on linux/386 and darwin/386

        Note: darwin/386 requires 16 byte stack alignment, and no
        effort has been made to support this at the moment. However,
        the tests pass on darwin/386 - not sure if I've been lucky.

Documentation

Overview

Package variadic implements interfaces for various variadic C calling conventions

Index

Constants

View Source
const (
	RDI = iota
	RDX
	RCX
	R8
	R9
	XMM0
	XMM1
	XMM2
	XMM3
	XMM4
	XMM5
	XMM6
	XMM7
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionCall

type FunctionCall struct {
	Words     [14]uintptr
	NumFloat  int64
	NumMemory int64
	Memory    unsafe.Pointer
	// contains filtered or unexported fields
}

func NewFunctionCall

func NewFunctionCall(name string) *FunctionCall

NewFunctionCall creates a new FunctionCall than can be used to call the C function named by the name parameter.

func NewFunctionCallAddr

func NewFunctionCallAddr(addr unsafe.Pointer) *FunctionCall

NewFunctionCallAddr creates a new FunctionCall that can be used to cll the C function at the address given by the addr parameter.

func (*FunctionCall) Call

func (f *FunctionCall) Call() uintptr

Call calls the FunctionCall's underlying function, returning its return value as an uintptr.

func (*FunctionCall) CallFloat32

func (f *FunctionCall) CallFloat32() float32

CallFloat32 calls the FunctionCall's underlying function, returning its return value as a float32.

func (*FunctionCall) CallFloat64

func (f *FunctionCall) CallFloat64() float64

CallFloat64 calls the FunctionCall's underlying function, returning its return value as float64.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL