github.com/q45/go@v0.0.0-20151101211701-a4fb8c13db3f/misc/cgo/testcarchive/main.c (about)

     1  // Copyright 2015 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 <stdint.h>
     6  #include <stdio.h>
     7  
     8  #include "p.h"
     9  #include "libgo.h"
    10  
    11  int main(void) {
    12  	int32_t res;
    13  
    14  	if (!DidInitRun()) {
    15  		fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
    16  		return 2;
    17  	}
    18  
    19  	if (DidMainRun()) {
    20  		fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
    21  		return 2;
    22  	}
    23  
    24  	res = FromPkg();
    25  	if (res != 1024) {
    26  		fprintf(stderr, "ERROR: FromPkg()=%d, want 1024\n", res);
    27  		return 2;
    28  	}
    29  
    30  	CheckArgs();
    31  
    32  	fprintf(stderr, "PASS\n");
    33  	return 0;
    34  }