From ecb2d545088a65eb681f9a181bc39b854d39f057 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 28 Jan 2019 01:43:31 -0800 Subject: fix for 0.19.2 --- nimterop/types.nim | 28 +++++++++++++++++++++++----- 1 file 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:"".} = 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: "".} = 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: "".} = distinct int32 + else: + type Time {.importc: "time_t", header: "".} = 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 -- cgit v1.2.3