All loading of source files is achieved by load_files/2. The hook prolog_load_file/2 can be used to load Prolog code from non-files or even load entirely different information, such as foreign files.
stream(Input) option. The hook must be 
defined in the module user.
This can be used to load from unusual places. For example, library
library(http/http_load) loads Prolog directly from an HTTP 
server. It can also be used to load source in unusual forms, such as 
loading compressed files without decompressing them first. There is 
currently no example of that.
comments(Comments). If the list of comments returned by
read_term/2 
is not empty it calls this comment hook with the following arguments.
This hook is exploited by the documentation system. See stream_position_data/3. See also read_term/3.