github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/cgo/internal/test/testx.go (about) 1 // Copyright 2011 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 // Test cases for cgo. 6 // Both the import "C" prologue and the main file are sorted by issue number. 7 // This file contains //export directives on Go functions 8 // and so it must NOT contain C definitions (only declarations). 9 // See test.go for C definitions. 10 11 package cgotest 12 13 import ( 14 "github.com/shogo82148/std/unsafe" 15 ) 16 17 import "C" 18 19 //export ReturnIntLong 20 func ReturnIntLong() (int, C.long) 21 22 //export Add 23 func Add(x int) 24 25 //export BackIntoGo 26 func BackIntoGo() 27 28 //export Issue1560FromC 29 func Issue1560FromC() 30 31 func Issue1560FromGo() 32 33 //export GoIssue6833Func 34 func GoIssue6833Func(aui uint, aui64 uint64) uint64 35 36 const CString = "C string" 37 38 //export CheckIssue6907Go 39 func CheckIssue6907Go(s string) C.int 40 41 //export Test8945 42 func Test8945() 43 44 //export GoFunc37033 45 func GoFunc37033(handle C.uintptr_t) 46 47 // issue 38408 48 // A typedef pointer can be used as the element type. 49 // No runtime test; just make sure it compiles. 50 var _ C.PIssue38408 = &C.Issue38408{i: 1} 51 52 //export GoFunc49633 53 func GoFunc49633(context unsafe.Pointer)