Implement PR #17
This commit is contained in:
parent
e2430cf40c
commit
1e086d5959
3 changed files with 21 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ proc execCmd(cmd:string)=
|
||||||
|
|
||||||
task test, "Test":
|
task test, "Test":
|
||||||
execCmd "nim c -r tests/tnimterop_c.nim"
|
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"
|
execCmd "nim cpp -r tests/tnimterop_cpp.nim"
|
||||||
# when defined(windows):
|
# when defined(windows):
|
||||||
# execCmd "nim c -r tests/tmath.nim"
|
# execCmd "nim c -r tests/tmath.nim"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,18 @@ extern "C" {
|
||||||
#define TEST_FLOAT 5.12
|
#define TEST_FLOAT 5.12
|
||||||
#define TEST_HEX 0x512
|
#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 uint8_t PRIMTYPE;
|
||||||
typedef PRIMTYPE CUSTTYPE;
|
typedef PRIMTYPE CUSTTYPE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ check TEST_INT == 512
|
||||||
check TEST_FLOAT == 5.12
|
check TEST_FLOAT == 5.12
|
||||||
check TEST_HEX == 0x512
|
check TEST_HEX == 0x512
|
||||||
|
|
||||||
|
when defined(osx):
|
||||||
|
check OSDEF == 10
|
||||||
|
elif defined(windows):
|
||||||
|
check OSDEF == 20
|
||||||
|
else:
|
||||||
|
check OSDEF == 30
|
||||||
|
|
||||||
var
|
var
|
||||||
pt: PRIMTYPE
|
pt: PRIMTYPE
|
||||||
ct: CUSTTYPE
|
ct: CUSTTYPE
|
||||||
|
|
@ -34,7 +41,7 @@ var
|
||||||
u: UNION1
|
u: UNION1
|
||||||
u2: UNION2
|
u2: UNION2
|
||||||
|
|
||||||
i: int
|
i: cint
|
||||||
|
|
||||||
pt = 3
|
pt = 3
|
||||||
ct = 4
|
ct = 4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue