| 1 |
import core.runtime; |
| 2 |
import core.stdc.string; |
| 3 |
import core.sys.posix.dlfcn; |
| 4 |
|
| 5 |
extern(C) alias RunDepTests = int function(const char*); |
| 6 |
|
| 7 |
void main(string[] args) |
| 8 |
{ |
| 9 |
auto name = args[0] ~ '\0'; |
| 10 |
const pathlen = strrchr(name.ptr, '/') - name.ptr + 1; |
| 11 |
auto root = name[0 .. pathlen]; |
| 12 |
auto libloaddep = root ~ "libloaddep.so"; |
| 13 |
auto h = Runtime.loadLibrary(libloaddep); |
| 14 |
auto runDepTests = cast(RunDepTests)dlsym(h, "runDepTests"); |
| 15 |
assert(runDepTests((root ~ "lib.so\0").ptr)); |
| 16 |
assert(Runtime.unloadLibrary(h)); |
| 17 |
} |