Merge pull request #4008 from aberghage/dynlib-errors-to-stderr
Makes dyncall errors report to stderr.
This commit is contained in:
commit
b4f1eef3a3
1 changed files with 7 additions and 7 deletions
|
|
@ -23,16 +23,16 @@ proc rawWrite(f: File, s: string) =
|
||||||
|
|
||||||
proc nimLoadLibraryError(path: string) =
|
proc nimLoadLibraryError(path: string) =
|
||||||
# carefully written to avoid memory allocation:
|
# carefully written to avoid memory allocation:
|
||||||
stdout.rawWrite("could not load: ")
|
stderr.rawWrite("could not load: ")
|
||||||
stdout.rawWrite(path)
|
stderr.rawWrite(path)
|
||||||
stdout.rawWrite("\n")
|
stderr.rawWrite("\n")
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
proc procAddrError(name: cstring) {.noinline.} =
|
proc procAddrError(name: cstring) {.noinline.} =
|
||||||
# carefully written to avoid memory allocation:
|
# carefully written to avoid memory allocation:
|
||||||
stdout.rawWrite("could not import: ")
|
stderr.rawWrite("could not import: ")
|
||||||
stdout.write(name)
|
stderr.write(name)
|
||||||
stdout.rawWrite("\n")
|
stderr.rawWrite("\n")
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
# this code was inspired from Lua's source code:
|
# this code was inspired from Lua's source code:
|
||||||
|
|
@ -71,7 +71,7 @@ when defined(posix):
|
||||||
when defined(nimDebugDlOpen):
|
when defined(nimDebugDlOpen):
|
||||||
let error = dlerror()
|
let error = dlerror()
|
||||||
if error != nil:
|
if error != nil:
|
||||||
c_fprintf(c_stdout, "%s\n", error)
|
c_fprintf(c_stderr, "%s\n", error)
|
||||||
|
|
||||||
proc nimGetProcAddr(lib: LibHandle, name: cstring): ProcAddr =
|
proc nimGetProcAddr(lib: LibHandle, name: cstring): ProcAddr =
|
||||||
result = dlsym(lib, name)
|
result = dlsym(lib, name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue