mirror of
https://github.com/golang/go
synced 2024-11-12 09:50:21 -07:00
fdab2f92ea
Change-Id: I1668a6885c45180ff88fe673d04cec7eba395ee7 Reviewed-on: https://go-review.googlesource.com/8861 Reviewed-by: Ian Lance Taylor <iant@golang.org>
35 lines
751 B
C
35 lines
751 B
C
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
typedef struct { char *p; intmax_t n; } GoString;
|
|
extern signed char DidInitRun();
|
|
extern signed char DidMainRun();
|
|
extern GoString FromPkg();
|
|
|
|
int main(void) {
|
|
GoString res;
|
|
|
|
if (DidMainRun()) {
|
|
fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
|
|
return 2;
|
|
}
|
|
|
|
if (!DidInitRun()) {
|
|
fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
|
|
return 2;
|
|
}
|
|
|
|
res = FromPkg();
|
|
if (strcmp(res.p, "str")) {
|
|
fprintf(stderr, "ERROR: FromPkg()='%s', want 'str'\n", res.p);
|
|
return 2;
|
|
}
|
|
|
|
return 0;
|
|
}
|