ChinaUnix.net
相关文章推荐:

dlsym

int dev_func(char dev_func_name[]) { int res; void *handle; int (*func)(); char *error; handle = dlopen(dev_lib_path, RTLD_LAZY); if(!handle) { LOG(m_event, ERROR, "%s\n", dlerror()); return FAIL; } func = dlsym(handle, dev_func_name); if((error = dlerror()) != NULL) { LOG(m_event, ERROR, "%s\n", error); dlclose(handle); ...

by WHITLACK - C/C++ - 2009-02-19 01:01:41 阅读(4663) 回复(2)

相关讨论

把esql/c的代码编进动态库,结果调用dlsym时返回22:"Function not implemented" 明明有这个东西啊

by jchc - C/C++ - 2008-07-02 15:10:26 阅读(2144) 回复(1)

我在.so中有这两个函数: extern "C" { Progress * createInstance() { return new Prog_A; } void destroyInstance(Progress * p) { delete p; } } 然后用Create_t * pfCreate = (Create_t *)dlsym(dp,"createInstance");调用,可是却报函数未实现。这是为什么呢?

by jchc - C/C++ - 2008-09-09 11:41:11 阅读(3517) 回复(11)

使用dlsym可以调用so里面定义的函数,但是我想调用类里面的成员函数怎么办阿? 例如,在so里面有print的函数,我可以使用dlsym(handle,"print")得到这个函数指针, 但是,我定义了class A 里面有个A.print函数,我怎么用dlsym来得到这个函数指针阿?

by sharkconi - C/C++ - 2006-07-19 16:43:42 阅读(2600) 回复(1)

声明了一个如下类型的函数指针 [code]int (*cmd)(arg1,arg2);[/code] 程序我是这样写的: [code] dp=dlopen(...); cmd=dlsym(dp,“cmd”); [/code] 用g++编译返回错误是: [code] invalid conversion from `void*' to `int (*)(arg1, arg2)' [/code] c++里边应该怎么进行这样的转换?

by wmytch - C/C++ - 2005-09-14 14:12:02 阅读(3194) 回复(4)

rt.我的对象定义和实现都在动态库中。通过dlsym调用其中的对象构造方法创建了对象,之后能否就dlclose()并继续使用对象?还是说一直要等对象销毁后才能dlclose()?

by jchc - C/C++ - 2008-10-07 18:33:49 阅读(1576) 回复(1)

假设dlsym获得函数指针后,为节省资源起见,我能否就关闭动态库,并继续使用这些函数?不然难道要在整个使用期内动态库一直开着,到最后才能dlclose?

by jchc - C/C++ - 2008-12-23 10:02:25 阅读(2867) 回复(8)

学习使用dlopen等函数动态加载函数,测试程序如下: #include #include #include int usage() { return 1; } int main() { void* handle,*p; char * error; handle = dlopen(NULL,RTLD_NOW); if (!handle) { fputs (dlerror(), stderr); exit(1); } p = dlsym(handle, "usage"); if ((error = dlerror()) != NULL) { fputs(error, stderr); exit(1); } } 运行后,dlsym的...

by sharevon - C/C++ - 2011-05-25 23:46:11 阅读(23878) 回复(13)

**testlib.cpp文件 #include ; int FF() { printf("测试函数被调用\n"); return 0; } **testlib.cpp 的makefile testlib.so:testlib.o aCC -b -o testlib.so testlib.o testlib.o:testlib.cpp aCC -c +z testlib.cpp clean: rm testlib.so testlib.o **testmain.cpp #include ; #include ; #include ; void *FunctionLib; int (*Function)(); co...

by lwtrante - HP-UX - 2005-07-18 11:42:20 阅读(1476) 回复(0)

编译没有问题,运行时报错,该怎么解决啊?是什么原因啊?我的系统是unixware,定位是在建立socket连接收数据时报错 dynamic linker: pniAlmSub: dlsym: cannot find symbol: _rs__is_res_use_inet6 Killed

by yudong_liu - 其他UNIX - 2005-04-12 15:47:14 阅读(1173) 回复(1)

在sco openserver下面看dlsym的man帮助,里面的例程如下: void *handle; int i, *iptr; int (*fptr)(int); /* open the needed object */ handle = dlopen("/usr/mydir/libx.so", RTLD_LAZY); /* find address of function and data objects */ fptr = (int (*)(int))dlsym(handle, "some_function"); iptr = (int *)dlsym(handle, "int_object"); //??? /* invoke function, passing value ...

by forest077 - C/C++ - 2004-07-16 09:36:48 阅读(2397) 回复(5)