Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 45 lines (37 sloc) 1.612 kB
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 type bypass_plugin_file = SharedObject of string | MarshalPlugin of string
19 let file = function
20 | SharedObject s | MarshalPlugin s -> s
21
22 let load_bypass_plugin = function
23 | SharedObject file -> (
24 try
25 OManager.verbose "loading file \"%s\" (plugin)" file;
26 Dynlink.loadfile_private file
27 with
28 | Dynlink.Error e ->
29 OManager.printf "Primitives librairy plugin:@ Cannot dynlink file @{<bright>%S@}@\n" file;
30 OManager.error "@[<2>@{<bright>Hint@}:@\n%s@]@\n" (Dynlink.error_message e)
31 )
32 | MarshalPlugin file ->
33 OManager.verbose "loading file \"%s\" (plugin)" file;
34 BslMarshalPlugin.loadfile_private file
35
36 let loadfile_private = load_bypass_plugin
37
38 let cache : (bypass_plugin_file, unit) Hashtbl.t = Hashtbl.create 16
39 let load_bypass_plugin_cache bypass_plugin =
40 if not (Hashtbl.mem cache bypass_plugin)
41 then (
42 Hashtbl.add cache bypass_plugin () ;
43 load_bypass_plugin bypass_plugin
44 )
Something went wrong with that request. Please try again.