diff options
| author | Omar Rizwan <omar@omar.website> | 2022-11-18 00:37:12 +0000 |
|---|---|---|
| committer | Omar Rizwan <omar@omar.website> | 2022-11-18 00:37:12 +0000 |
| commit | 316ff618bb042168b3dff6fa14ed91c710d1595a (patch) | |
| tree | 0bfe972cee61abbc96e1ede23f001e8d39c1500d /lib | |
| parent | Don't need to reset C now that it's namespaced (diff) | |
| download | folk-316ff618bb042168b3dff6fa14ed91c710d1595a.tar.gz folk-316ff618bb042168b3dff6fa14ed91c710d1595a.zip | |
Add loadlib to c.tcl
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/c.tcl | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -161,7 +161,20 @@ namespace eval c { }] return $handle } - namespace export create + + set loader [create] + $loader include <dlfcn.h> + $loader proc loadlibImpl {char* filename} void* { + return dlopen(filename, RTLD_NOW); + } + $loader compile + proc loadlib {filename} { + if {[loadlibImpl $filename] == "(void*) 0x0"} { + error "Failed to dlopen $filename" + } + } + + namespace export * namespace ensemble create } |
