github.com/bir3/gocompiler@v0.9.2202/src/cmd/cgo/internal/test/issue24161e2/main.go (about)

     1  // Copyright 2018 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  //go:build darwin
     6  
     7  package issue24161e2
     8  
     9  /*
    10  #cgo CFLAGS: -x objective-c
    11  #cgo LDFLAGS: -framework CoreFoundation -framework Security
    12  #include <TargetConditionals.h>
    13  #include <CoreFoundation/CoreFoundation.h>
    14  #include <Security/Security.h>
    15  #if TARGET_OS_IPHONE == 0 && __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
    16    typedef CFStringRef SecKeyAlgorithm;
    17    static CFDataRef SecKeyCreateSignature(SecKeyRef key, SecKeyAlgorithm algorithm, CFDataRef dataToSign, CFErrorRef *error){return NULL;}
    18    #define kSecKeyAlgorithmECDSASignatureDigestX962SHA1 foo()
    19    static SecKeyAlgorithm foo(void){return NULL;}
    20  #endif
    21  */
    22  import "C"
    23  import (
    24  	"fmt"
    25  	"testing"
    26  )
    27  
    28  var _ C.CFStringRef
    29  
    30  func f1() {
    31  	C.SecKeyCreateSignature(0, C.kSecKeyAlgorithmECDSASignatureDigestX962SHA1, 0, nil)
    32  }
    33  
    34  func f2(e C.CFErrorRef) {
    35  	if desc := C.CFErrorCopyDescription(e); desc != 0 {
    36  		fmt.Println(desc)
    37  	}
    38  }
    39  
    40  func Test(t *testing.T) {}