Skip to content

Instantly share code, notes, and snippets.

@cartazio
Last active October 3, 2016 18:14
Show Gist options
  • Save cartazio/d2cb3b79eb28444b1d6a405bc0943d80 to your computer and use it in GitHub Desktop.
Save cartazio/d2cb3b79eb28444b1d6a405bc0943d80 to your computer and use it in GitHub Desktop.
dylib testing codes; dltest.c takes a single argument thats a file path to a dylib.
#! /bin/bash
for x in {1..256}; do install_name_tool -add_rpath /$(printf '%127.127d' $x) $targetfile; done
# note .. need to replace $targetfile with either the first cli arge variable or a concrete file for this to not be
# terrible
#include <dlfcn.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
if (dlopen(argv[1], RTLD_NOW | RTLD_GLOBAL) == NULL) {
printf("%s\n", dlerror());
return 1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment