Source file
src/runtime/cgo/library_ext_test.go
1
2
3
4
5
6
7 package cgo_test
8
9 import (
10 "runtime"
11 "runtime/cgo"
12 "testing"
13 )
14
15
16 type myLib struct {
17 cgo.Library
18 name string
19 }
20
21 func TestOpenEmbedded(t *testing.T) {
22 var path string
23 switch runtime.GOOS {
24 case "linux":
25 path = "libc.so.6"
26 case "darwin", "ios":
27 path = "/usr/lib/libSystem.B.dylib"
28 case "windows":
29 path = "msvcrt.dll"
30 default:
31 t.Skipf("no known C library path on %s", runtime.GOOS)
32 }
33
34
35 lib, err := cgo.Open[myLib](path)
36 if err != nil {
37 t.Fatal(err)
38 }
39 var _ *myLib = lib
40 }
41
View as plain text