mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 07:43:26 +00:00
fixes #18896 fixes #20886 ```nim type PFile {.importc: "FILE*", header: "<stdio.h>".} = distinct pointer # import C's FILE* type; Nim will treat it as a new pointer type ``` This is an excerpt from the Nim manual. In the old Nim versions, it produces a void pointer type instead of the `FILE*` type that should have been generated. Because these C types tend to be opaque and adapt to changes on different platforms. It might affect the portability of Nim on various OS, i.e. `csource_v2` cannot build on the apline platform because of `Time` relies on Nim types instead of the `time_t` type. ref https://github.com/nim-lang/Nim/pull/18851
14 lines
191 B
Nim
14 lines
191 B
Nim
discard """
|
|
ccodecheck: "time_t"
|
|
joinable: false
|
|
"""
|
|
|
|
type
|
|
Time* {.importc: "time_t", header: "<time.h>".} = distinct clong
|
|
|
|
proc foo =
|
|
var s: Time = default(Time)
|
|
discard s
|
|
|
|
foo()
|