Implement PR #17

This commit is contained in:
Ganesh Viswanathan 2018-12-28 00:33:09 -06:00
commit 1e086d5959
3 changed files with 21 additions and 2 deletions

View file

@ -18,7 +18,7 @@ proc execCmd(cmd:string)=
task test, "Test":
execCmd "nim c -r tests/tnimterop_c.nim"
execCmd "nim cpp -r tests/tnimterop_c.nim"
#execCmd "nim cpp -r tests/tnimterop_c.nim"
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
# when defined(windows):
# execCmd "nim c -r tests/tmath.nim"

View file

@ -8,6 +8,18 @@ extern "C" {
#define TEST_FLOAT 5.12
#define TEST_HEX 0x512
#ifdef __APPLE__
#define OSDEF 10
#endif
#ifdef _WIN32
#define OSDEF 20
#endif
#ifdef __linux__
#define OSDEF 30
#endif
typedef uint8_t PRIMTYPE;
typedef PRIMTYPE CUSTTYPE;

View file

@ -13,6 +13,13 @@ check TEST_INT == 512
check TEST_FLOAT == 5.12
check TEST_HEX == 0x512
when defined(osx):
check OSDEF == 10
elif defined(windows):
check OSDEF == 20
else:
check OSDEF == 30
var
pt: PRIMTYPE
ct: CUSTTYPE
@ -34,7 +41,7 @@ var
u: UNION1
u2: UNION2
i: int
i: cint
pt = 3
ct = 4