...
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#include "_cgo_export.h"
6
7static void callDestructorCallback() {
8 GoDestructorCallback();
9}
10
11static void (*destructorFn)(void);
12
13void registerDestructor() {
14 destructorFn = callDestructorCallback;
15}
16
17__attribute__((destructor))
18static void destructor() {
19 if (destructorFn) {
20 destructorFn();
21 }
22}
View as plain text