Merge branch 'swig-fortran/extern-c-int'

Fixes #2199
This commit is contained in:
Olly Betts 2022-02-11 08:28:27 +13:00
commit b624d17f3f
4 changed files with 37 additions and 4 deletions

View file

@ -16,7 +16,9 @@ thread_local static int tsval;
extern thread_local int etval;
thread_local extern int teval;
extern "C" thread_local int ectval;
extern "C" { thread_local int ectval2 = 56; }
extern "C++" thread_local int ecpptval;
extern "C++" { thread_local int ecpptval2 = 67; }
thread_local int ThreadLocals::stval = 11;
thread_local int ThreadLocals::tsval = 22;
@ -30,6 +32,10 @@ thread_local const int ThreadLocals::tscval99;
// externs
thread_local int etval = 33;
thread_local int teval = 44;
extern "C" {
thread_local int ectval = 55;
}
extern "C++" {
thread_local int ecpptval = 66;
}
%}

View file

@ -5,6 +5,7 @@ extern "C" {
void RealFunction(int value);
typedef void Function1(int value); // Fails
typedef int Integer1;
int Integer3;
}
typedef void Function2(int value); // Works
typedef int Integer2;
@ -27,5 +28,14 @@ Hook2_t hook2;
extern "C" typedef int Integer;
Integer int1;
extern "C" int int2;
extern "C" { extern int int3; }
extern "C" { int int4 = 789; }
%}
%{
extern "C" {
int int2 = 123;
int int3 = 456;
}
%}

View file

@ -1,3 +1,6 @@
import extern_c
extern_c.RealFunction(2)
assert extern_c.cvar.int2 == 123
assert extern_c.cvar.int3 == 456
assert extern_c.cvar.int4 == 789