github.com/ebitengine/purego@v0.8.0-alpha.2.0.20240512170805-6cd12240d332/testdata/libcbtest/callback_test.c (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // SPDX-FileCopyrightText: 2023 The Ebitengine Authors
     3  
     4  #include <string.h>
     5  
     6  typedef int (*callback)(const char *, int);
     7  
     8  int callCallback(const void *fp, const char *s) {
     9      // If the callback corrupts FP, this local variable on the stack will have incorrect value.
    10      int sentinel = 10101;
    11      ((callback)(fp))(s, strlen(s));
    12      return sentinel;
    13  }