From 912c1c24c32799c63949fdf466fccd31f84a1aa1 Mon Sep 17 00:00:00 2001 From: Sahnvour Date: Sat, 21 Sep 2019 17:42:00 +0200 Subject: [PATCH] simple test for exporting variables in static libs --- test/standalone/static_c_lib/foo.c | 2 ++ test/standalone/static_c_lib/foo.h | 1 + test/standalone/static_c_lib/foo.zig | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/test/standalone/static_c_lib/foo.c b/test/standalone/static_c_lib/foo.c index 2366282d47e315c971de79608ec86645a19da170..78a332a6eea6f05dce81d696f32359cce255f409 100644 --- a/test/standalone/static_c_lib/foo.c +++ b/test/standalone/static_c_lib/foo.c @@ -2,3 +2,5 @@ uint32_t add(uint32_t a, uint32_t b) { return a + b; } + +uint32_t foo = 12345; diff --git a/test/standalone/static_c_lib/foo.h b/test/standalone/static_c_lib/foo.h index e8ebb9842e6f165bffb4e78fd189be8dbea5feda..6700499fe8dcc968d28376be642c8fade5ee0407 100644 --- a/test/standalone/static_c_lib/foo.h +++ b/test/standalone/static_c_lib/foo.h @@ -1,2 +1,3 @@ #include uint32_t add(uint32_t a, uint32_t b); +extern uint32_t foo; diff --git a/test/standalone/static_c_lib/foo.zig b/test/standalone/static_c_lib/foo.zig index edf94539c82a102f57656f817929ca6d841ae969..a5ba90c95dab97f3a6fa77526f557a1737d054a4 100644 --- a/test/standalone/static_c_lib/foo.zig +++ b/test/standalone/static_c_lib/foo.zig @@ -6,3 +6,7 @@ test "C add" { const result = c.add(1, 2); expect(result == 3); } + +test "C extern variable" { + expect(c.foo == 12345); +} -- 2.54.0