authorgravatar for sahnvour@pm.meSahnvour <sahnvour@pm.me> 2019-09-21 17:42:00+02:00
committergravatar for sahnvour@pm.meSahnvour <sahnvour@pm.me> 2019-11-24 21:33:58+01:00
log912c1c24c32799c63949fdf466fccd31f84a1aa1
tree3f14d8defcf90b62902a0249636fffc873e1c17c
parent1bde3b68218ecc25bfcc5e2304399294f83a74d8

simple test for exporting variables in static libs


3 files changed, 7 insertions(+), 0 deletions(-)

test/standalone/static_c_lib/foo.c+2
...@@ -2,3 +2,5 @@...@@ -2,3 +2,5 @@
2uint32_t add(uint32_t a, uint32_t b) {2uint32_t add(uint32_t a, uint32_t b) {
3 return a + b;3 return a + b;
4}4}
5
6uint32_t foo = 12345;
test/standalone/static_c_lib/foo.h+1
...@@ -1,2 +1,3 @@...@@ -1,2 +1,3 @@
1#include <stdint.h>1#include <stdint.h>
2uint32_t add(uint32_t a, uint32_t b);2uint32_t add(uint32_t a, uint32_t b);
3extern uint32_t foo;
test/standalone/static_c_lib/foo.zig+4
...@@ -6,3 +6,7 @@ test "C add" {...@@ -6,3 +6,7 @@ test "C add" {
6 const result = c.add(1, 2);6 const result = c.add(1, 2);
7 expect(result == 3);7 expect(result == 3);
8}8}
9
10test "C extern variable" {
11 expect(c.foo == 12345);
12}