Skip to content

Instantly share code, notes, and snippets.

@drKreso
Forked from anonymous/gist:5070416
Last active December 14, 2015 10:10
Show Gist options
  • Select an option

  • Save drKreso/5070534 to your computer and use it in GitHub Desktop.

Select an option

Save drKreso/5070534 to your computer and use it in GitHub Desktop.
char *lib_name_2;
/* Initialize the object; grab native call part of its body. */
NativeCallBody *body = get_nc_body(interp, $1);
/* Try to load the library. */
body->lib_name = lib_name;
body->lib_handle = dlLoadLibrary(strlen(lib_name) ? lib_name : NULL);
if (!body->lib_handle) {
INTVAL pos = STRING_index(interp, $2, Parrot_str_new(interp, ".bundle", 0), 0);
STRING * lib_name_alternative = Parrot_str_replace(interp, $2, pos, 7, Parrot_str_new(interp, ".dylib", 0));
*lib_name_2 = Parrot_str_to_cstring(interp, lib_name_alternative);
printf( "Did not found %s trying with %s",lib_name, lib_name_2);
body->lib_name = lib_name_2;
body->lib_handle = dlLoadLibrary(strlen(lib_name_2) ? lib_name_2 : NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment