Created
March 2, 2013 10:22
-
-
Save anonymous/5070416 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ inline op nqp_native_call_build(invar PMC, in STR, in STR, in STR, invar PMC, invar PMC) :base_core { char *lib_name = Parrot_str_to_cstring(interp, $2); char *sym_name = Parrot_str_to_cstring(interp, $3); PMC *arg_info = $5; PMC *ret_info = $6; int i; 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, 5, ".dylib"); *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); }