1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:50:21 -07:00
go/misc/cgo/testcarchive/main.c
David Crawshaw c5befcf0a7 misc/cgo/testcarchive: check that os.Args is set
Change-Id: I4278abca9d2a8f25149fa8935a93d32e7d04a43a
Reviewed-on: https://go-review.googlesource.com/9050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-17 22:29:51 +00:00

36 lines
705 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>
extern signed char DidInitRun();
extern signed char DidMainRun();
extern int32_t FromPkg();
extern void CheckArgs();
int main(void) {
int32_t res;
if (!DidInitRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
return 2;
}
if (DidMainRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
return 2;
}
res = FromPkg();
if (res != 1024) {
fprintf(stderr, "ERROR: FromPkg()=%d, want 1024\n", res);
return 2;
}
CheckArgs();
return 0;
}