...

Source file src/runtime/testdata/testprogcgo/destructor.go

Documentation: runtime/testdata/testprogcgo

     1  // Copyright 2023 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  package main
     6  
     7  // extern void registerDestructor();
     8  import "C"
     9  
    10  import "fmt"
    11  
    12  func init() {
    13  	register("DestructorCallback", DestructorCallback)
    14  }
    15  
    16  //export GoDestructorCallback
    17  func GoDestructorCallback() {
    18  }
    19  
    20  func DestructorCallback() {
    21  	C.registerDestructor()
    22  	fmt.Println("OK")
    23  }
    24  

View as plain text