aboutsummaryrefslogtreecommitdiffstats
path: root/interface/optdl.hpp
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-11-03 10:55:48 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-11-03 10:55:48 +0000
commitc7489cfe3f319805c069968e143e13585dcdd664 (patch)
treefb0c09ccdd0599b7e3ce03e9e199e34fd4a0f6a3 /interface/optdl.hpp
parent4f7f2c239904be0af4ee96d1565dd336d2e287a9 (diff)
downloadopt-utilities-c7489cfe3f319805c069968e143e13585dcdd664.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@89 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'interface/optdl.hpp')
-rw-r--r--interface/optdl.hpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/interface/optdl.hpp b/interface/optdl.hpp
index 5f44733..7956155 100644
--- a/interface/optdl.hpp
+++ b/interface/optdl.hpp
@@ -8,21 +8,34 @@
#include <iostream>
#include <string>
#include <sstream>
-#include <dlfcn.h>
+//#include <dlfcn.h>
+#include <ltdl.h>
namespace opt_utilities
{
+ static class dl_init
+ {
+ public:
+ dl_init()
+ {
+ lt_dlinit();
+ }
+ ~dl_init()
+ {
+ lt_dlexit();
+ }
+ }_dl_init;
+
+
template <typename Ty,
typename Tx,
typename Tp,
typename Tstr>
model<Ty,Tx,Tp,Tstr>* load_model(const char* fname)
{
- void* handle;
-
- handle=dlopen(fname,RTLD_LAZY);
-
+ lt_dlhandle handle;
+ handle=lt_dlopen(fname);
if(!handle)
{
throw opt_exception("faild loading object");
@@ -31,7 +44,7 @@ namespace opt_utilities
model<Ty,Tx,Tp,Tstr>* (*func_create)();
- func_create=(model<Ty,Tx,Tp,Tstr>* (*)())dlsym(handle,"create_model_object");
+ func_create=(model<Ty,Tx,Tp,Tstr>* (*)())lt_dlsym(handle,"create_model_object");
if(!func_create)
{
@@ -44,9 +57,9 @@ namespace opt_utilities
typename Tp>
opt_method<Ty,Tp>* load_opt_method(const char* fname)
{
- void* handle;
+ lt_dlhandle handle;
- handle=dlopen(fname,RTLD_LAZY);
+ handle=lt_dlopen(fname);
if(!handle)
{
@@ -56,7 +69,7 @@ namespace opt_utilities
opt_method<Ty,Tp>* (*func_create)();
- func_create=(opt_method<Ty,Tp>* (*)())dlsym(handle,"create_opt_method_object");
+ func_create=(opt_method<Ty,Tp>* (*)())lt_dlsym(handle,"create_opt_method_object");
if(!func_create)
{
@@ -69,9 +82,9 @@ namespace opt_utilities
typename Tp>
func_obj<Ty,Tp>* load_func_obj(const char* fname)
{
- void* handle;
+ lt_dlhandle handle;
- handle=dlopen(fname,RTLD_LAZY);
+ handle=lt_dlopen(fname);
if(!handle)
{
@@ -81,7 +94,7 @@ namespace opt_utilities
func_obj<Ty,Tp>* (*func_create)();
- func_create=(func_obj<Ty,Tp>* (*)())dlsym(handle,"create_func_obj_object");
+ func_create=(func_obj<Ty,Tp>* (*)())lt_dlsym(handle,"create_func_obj_object");
if(!func_create)
{
@@ -97,9 +110,9 @@ namespace opt_utilities
typename Tstr>
statistic<Ty,Tx,Tp,Ts,Tstr>* load_statistic(const char* fname)
{
- void* handle;
+ lt_dlhandle handle;
- handle=dlopen(fname,RTLD_LAZY);
+ handle=lt_dlopen(fname);
if(!handle)
{
@@ -109,7 +122,7 @@ namespace opt_utilities
statistic<Ty,Tx,Tp,Ts,Tstr>* (*func_create)();
- func_create=(statistic<Ty,Tx,Tp,Ts,Tstr>* (*)())dlsym(handle,"create_statistic_object");
+ func_create=(statistic<Ty,Tx,Tp,Ts,Tstr>* (*)())lt_dlsym(handle,"create_statistic_object");
if(!func_create)
{