summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2009-12-09 01:05:48 +0100
committerAndreas Rumpf <andreas@andreas-desktop>2009-12-09 01:05:48 +0100
commit27d7e3a0ae7f30d4e560880e0ce89c16f7bc4f6e (patch)
treebe429f58a20483f8831e7a7cdf2079a0fae6c117 /lib
parentf265c3e866616d98ff117243d05f88f1a0782ea2 (diff)
downloadNim-27d7e3a0ae7f30d4e560880e0ce89c16f7bc4f6e.tar.gz
BUGFIX: better error message when loading of dynamic lib proc fails
Diffstat (limited to 'lib')
-rwxr-xr-xlib/system/dyncalls.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim
index c0371d069..0946ee355 100755
--- a/lib/system/dyncalls.nim
+++ b/lib/system/dyncalls.nim
@@ -60,6 +60,7 @@ when defined(posix):
 
   proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr =
     result = dlsym(lib, name)
+    if result == nil: nimLoadLibraryError($name)
 
 elif defined(windows) or defined(dos):
   #
@@ -84,6 +85,7 @@ elif defined(windows) or defined(dos):
 
   proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr =
     result = GetProcAddress(cast[THINSTANCE](lib), name)
+    if result == nil: nimLoadLibraryError($name)
 
 elif defined(mac):
   #
@@ -114,11 +116,12 @@ elif defined(mac):
         NSDestroyObjectFileImage(img)
         result = TLibHandle(modul)
 
-  proc nimGetProcAddr(lib: TLibHandle, cname: string): TProcAddr =
+  proc nimGetProcAddr(lib: TLibHandle, name: cstring): TProcAddr =
     var
       nss: NSSymbol
     nss = NSLookupSymbolInModule(NSModule(lib), name)
     result = TProcAddr(NSAddressOfSymbol(nss))
+    if result == nil: nimLoadLibraryError($name)
 
 else:
   {.error: "no implementation for dyncalls".}