123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051(* Copyright (C) 2017--2018 Petter A. Urkedal <paurkedal@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version, with the OCaml static compilation exception.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*)letdebug=trybool_of_string(Sys.getenv"CAQTI_DEBUG_DYNLOAD")withNot_found->falseletbackend_predicates()=(matchSys.backend_typewith|Sys.Native->["native"]|Sys.Bytecode->["byte"]|Sys.Other_->[])letinit=lazybeginletpredicates=backend_predicates()inFindlib.init();Findlib.record_package_predicatespredicates;List.iter(Findlib.record_packageRecord_core)(Findlib.package_deep_ancestorspredicates["caqti"]);ifdebugthenPrintf.eprintf"\
[DEBUG] Caqti_dynload: recorded_predicates = %s\n\
[DEBUG] Caqti_dynload: recorded_packages.core = %s\n\
[DEBUG] Caqti_dynload: recorded_packages.load = %s\n%!"(String.concat" "(Findlib.recorded_predicates()))(String.concat" "(Findlib.recorded_packagesRecord_core))(String.concat" "(Findlib.recorded_packagesRecord_load))endlet()=Caqti_connect.define_loader@@funpkg->Lazy.forceinit;ifdebugthenPrintf.eprintf"[DEBUG] Caqti_dynload: requested package: %s\n"pkg;(tryOk(Fl_dynload.load_packages~debug[pkg])with|Dynlink.Errorerr->Error(Dynlink.error_messageerr)|Findlib.No_such_package(_pkg,info)->Errorinfo)moduleWeak_=structincludeWeakend(* for caqti-driver-mariadb *)