new VM: some progress for the FFI support
This commit is contained in:
parent
e2a4d591e5
commit
9145bcfbb6
8 changed files with 80 additions and 60 deletions
|
|
@ -194,9 +194,9 @@ const
|
|||
# should not be translated.
|
||||
|
||||
|
||||
proc Open(f: var TFile, filename: string,
|
||||
proc open(f: var TFile, filename: string,
|
||||
mode: TFileMode = fmRead,
|
||||
bufSize: int = -1): Bool =
|
||||
bufSize: int = -1): bool =
|
||||
var p: pointer = fopen(filename, FormatOpen[mode])
|
||||
result = (p != nil)
|
||||
f = cast[TFile](p)
|
||||
|
|
|
|||
|
|
@ -101,7 +101,8 @@ proc newWideCString*(s: cstring): WideCString =
|
|||
if s.isNil: return nil
|
||||
|
||||
when not defined(c_strlen):
|
||||
proc c_strlen(a: CString): int {.nodecl, noSideEffect, importc: "strlen".}
|
||||
proc c_strlen(a: cstring): int {.
|
||||
header: "<string.h>", noSideEffect, importc: "strlen".}
|
||||
|
||||
let L = cstrlen(s)
|
||||
result = newWideCString(s, L)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue