|
1 | 1 | var exportcTest {.exportc.}: int |
2 | 2 | var importcTest {.importc.}: int |
3 | 3 | var y* {.importc, header: "test.h".}: int |
| 4 | +var EACCES {.importc, nodecl.}: cint |
| 5 | +var volatileTest {.volatile.}: int |
| 6 | + |
| 7 | +const FooBar {.intdefine.}: int = 5 |
| 8 | +echo FooBar |
| 9 | + |
| 10 | +{.passc: "-Wall -Werror".} |
| 11 | +{.link: "myfile.o".} |
| 12 | + |
| 13 | +type |
| 14 | + TestImportC {.importc.} = object |
| 15 | + x: int |
| 16 | + |
| 17 | + TestImportC2 {.importc: "TestImportC2Name".} = object |
| 18 | + x {.importc.}: int |
| 19 | + y {.importc: "yyy".}: int |
| 20 | + |
| 21 | + TestBitfield = object |
| 22 | + flag {.bitsize:1.}: cuint |
| 23 | + |
| 24 | + TestEnumWithSize* {.size: sizeof(uint32).} = enum |
| 25 | + X, |
| 26 | + Y, |
| 27 | + Z |
| 28 | + |
| 29 | + sseType = object |
| 30 | + sseData {.align(16).}: array[4, float32] |
| 31 | + |
| 32 | + TestUnionObj {.union.} = object |
| 33 | + x: cint |
| 34 | + y: cfloat |
| 35 | + |
| 36 | +const irr = "<irrlicht/irrlicht.h>" |
| 37 | +type |
| 38 | + IrrlichtDeviceObj {.header: irr, |
| 39 | + importcpp: "irr::IrrlichtDevice".} = object |
| 40 | + |
| 41 | +proc importCProc() {.importc.} |
| 42 | +proc importCProc2(x: cint) {.importc: "import_c_proc_2".} |
| 43 | +proc headerProc(): cint {.importc, header: "foo.h".} |
| 44 | + |
| 45 | +proc exportCProc() {.exportc.} |
| 46 | + |
| 47 | +{.pragma: pragmaPragmaTest, importc, header: "foo.h".} |
| 48 | +proc pragmaPragmaTestProc() {.pragmaPragmaTest.} |
0 commit comments