aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-28 01:43:31 -0800
committergenotrance <dev@genotrance.com>2019-01-28 16:47:13 -0600
commitecb2d545088a65eb681f9a181bc39b854d39f057 (patch)
tree70b5c63908455096404aedca9929039d3ebcc7ac
parent343024738a57dc0c201d54068b79e24e873f00c7 (diff)
downloadnimterop-ecb2d545088a65eb681f9a181bc39b854d39f057.tar.gz
nimterop-ecb2d545088a65eb681f9a181bc39b854d39f057.zip
fix for 0.19.2
-rw-r--r--nimterop/types.nim28
1 files changed, 23 insertions, 5 deletions
diff --git a/nimterop/types.nim b/nimterop/types.nim
index d9ffdcd..c9168d0 100644
--- a/nimterop/types.nim
+++ b/nimterop/types.nim
@@ -1,5 +1,5 @@
#[
-TODO:
+note:
this should pull as few dependencies as needed by the wrapper, one option is, for the types that carry a dependency, wrap the type declaration inside something like:
```
when defined(nimteropNeeds_va_list):
@@ -7,16 +7,34 @@ when defined(nimteropNeeds_va_list):
va_list* {.importc, header:"<stdarg.h>".} = object
```
-TODO:
+note:
nimterop should replace the generated wrappers with the nim-idiomatic version, eg:
```
proc mylib(a: ptrdiff_t) => proc mylib(a: ByteAddress)
```
-]#
-from std/time_t import nil # for time_t
+note:
+as needed, provide (platform specific) nim aliases which can be used eg to compute sizeof, eg:
+type foo_t* {.importc, header: "<foo.h>".} = distinct int32
+]#
-export time_t
+when (NimMajor, NimMinor, NimPatch) < (0, 19, 9):
+ # clean this up once upgraded; adapted from std/time_t
+ when defined(nimdoc):
+ type
+ impl = distinct int64
+ Time = impl
+ elif defined(windows):
+ when defined(i386) and defined(gcc):
+ type Time {.importc: "time_t", header: "<time.h>".} = distinct int32
+ else:
+ type Time {.importc: "time_t", header: "<time.h>".} = distinct int64
+ elif defined(posix):
+ import posix
+ type time_t* = Time
+else:
+ import std/time_t as time_t_temp
+ type time_t* = time_t_temp.Time
type
ptrdiff_t* = ByteAddress