- std::string strsofile = std::string(filename) + ".so";
- void* module = NULL;
- module = dlopen(strsofile.c_str(), RTLD_NOW);
- if (module == NULL) {
- throw std::runtime_error("excompiler: could not open compiled module!");
- }
+void link_ex(const std::string filename, FUNCP_2P& fp)
+{
+ // This is not standard compliant! ... no conversion between
+ // pointer-to-functions and pointer-to-objects ...
+ fp = (FUNCP_2P) global_excompiler.link_so_file(filename, false);
+}
+
+void link_ex(const std::string filename, FUNCP_CUBA& fp)
+{
+ // This is not standard compliant! ... no conversion between
+ // pointer-to-functions and pointer-to-objects ...
+ fp = (FUNCP_CUBA) global_excompiler.link_so_file(filename, false);
+}
+
+void unlink_ex(const std::string filename)
+{
+ global_excompiler.unlink(filename);
+}
+
+#elif // def HAVE_LIBDL
+
+/*
+ * In case no working libdl has been found by configure, the following function
+ * stubs preserve the interface. Every function just raises an exception.
+ */
+
+void compile_ex(const ex& expr, const symbol& sym, FUNCP_1P& fp, const std::string filename)
+{
+ throw std::runtime_error("compile_ex has been disabled because of missing libdl!");
+}
+
+void compile_ex(const ex& expr, const symbol& sym1, const symbol& sym2, FUNCP_2P& fp, const std::string filename)
+{
+ throw std::runtime_error("compile_ex has been disabled because of missing libdl!");
+}