now
. This is similar to using:
:- initialization(load_foreign_library(foreign(mylib))).
but using the initialization/1 wrapper causes the library to be loaded after loading of the file in which it appears is completed, while use_foreign_library/1 loads the library immediately. I.e. the difference is only relevant if the remainder of the file uses functionality of the C-library.
As of SWI-Prolog 8.1.22, use_foreign_library/1,2
is in provided as a built-in predicate that, if necessary, loads library(shlib)
.
This implies that these directives can be used without explicitly
loading
library(shlib)
or relying on demand loading.