tests: Test extern'd globals on MacOS with the Apple Archiver
This forces the use of the Apple archiver, since that archiver doesn't add extern'd variables to the symbol table automatically, and instead requires that ranlib be used. A native file is used to ensure that Apple's ar is used even in the presence of llvm or gcc in the path with their superior archivers. Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
parent
bdc6f243e9
commit
d285be763f
|
@ -0,0 +1,9 @@
|
|||
// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern int l2;
|
||||
void l1(void)
|
||||
{
|
||||
printf("l1 %d\n", l2);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
|
||||
|
||||
int l2;
|
||||
void l2_func(void)
|
||||
{
|
||||
l2 = 77;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
# Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
|
||||
|
||||
project('global variable test', 'c')
|
||||
|
||||
lib = static_library('mylib', 'libfile.c', 'libfile2.c')
|
||||
test('global variable', executable('prog', 'prog.c', link_with: lib))
|
|
@ -0,0 +1,2 @@
|
|||
[binaries]
|
||||
ar = 'ar'
|
|
@ -0,0 +1,7 @@
|
|||
// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
|
||||
|
||||
extern void l1(void);
|
||||
int main(void)
|
||||
{
|
||||
l1();
|
||||
}
|
Loading…
Reference in New Issue