diff --git a/C/load_foreign.c b/C/load_foreign.c index 692b1687b..c3c079d01 100755 --- a/C/load_foreign.c +++ b/C/load_foreign.c @@ -114,6 +114,15 @@ p_obj_suffix(void) { return Yap_unify(Yap_StringToList(YAP_SHLIB_SUFFIX),ARG1); } +static Int +p_open_shared_objects(void) { +#ifdef YAP_SHLIB_SUFFIX + return TRUE; +#else + return FALSE; +#endif +} + void Yap_InitLoadForeign(void) { @@ -122,6 +131,7 @@ Yap_InitLoadForeign(void) else Yap_FindExecutable(Yap_argv[0]); Yap_InitCPred("$load_foreign_files", 3, p_load_foreign, SafePredFlag|SyncPredFlag|HiddenPredFlag); + Yap_InitCPred("$open_shared_objects", 0, p_open_shared_objects, SafePredFlag|HiddenPredFlag); Yap_InitCPred("$obj_suffix", 1, p_obj_suffix, SafePredFlag|HiddenPredFlag); } diff --git a/pl/flags.yap b/pl/flags.yap index ef9f5db73..48149d080 100644 --- a/pl/flags.yap +++ b/pl/flags.yap @@ -165,11 +165,20 @@ yap_flag(dollar_as_lower_case,off) :- yap_flag(call_counting,X) :- (var(X); X = on; X = off), !, '$is_call_counted'(X). +yap_flag(open_shared_object,X) :- + var(X), !, + ('$open_shared_objects' -> X = true ; X = false). +yap_flag(open_shared_object,X) :- + (X = true ; X = false), !, + '$do_error'(permission_error(modify,flag,open_shared_object),yap_flag(open_shared_object,X)). +yap_flag(open_shared_object,X) :- + '$do_error'(domain_error(flag_value,open_shared_object+X),yap_flag(open_shared_object,X)). + yap_flag(bounded,X) :- var(X), !, '$access_yap_flags'(0, X1), '$transl_to_true_false'(X1,X). -yap_flag(bounded,X) :- !, +yap_flag(bounded,X) :- (X = true ; X = false), !, '$do_error'(permission_error(modify,flag,bounded),yap_flag(bounded,X)). yap_flag(bounded,X) :- @@ -826,6 +835,7 @@ yap_flag(dialect,yap). '$yap_system_flag'(min_tagged_integer). '$yap_system_flag'(n_of_integer_keys_in_db). '$yap_system_flag'(open_expands_filename). +'$yap_system_flag'(open_shared_object). '$yap_system_flag'(profiling). '$yap_system_flag'(prompt_alternatives_on). '$yap_system_flag'(redefine_warnings).