How to write/use DLL in Linux sy…
2014-01-15 12:06
537 查看
1. How to use DLL to create c++ class
http://blog.csdn.net/tlzhu/archive/2008/07/17/2663777.aspx2. How to write DLL and use DLL
http://www.ibm.com/developerworks/cn/linux/sdk/dll/index.html3. 在linux下编写动态链接库的步骤
http://blog.chinaunix.net/u3/97568/showart_2046606.htmldlopen -- load dll file to memory
dlerror -- return load failure root cause
dlsym - load function pointer from certain
dll in memory
dlclose - release dll file from memory4. A very simple case
http://bbs.loveunix.net/viewthread.php?tid=24316而在linux下 没有那么麻烦 下面给出例子
http://blog.csdn.net/tlzhu/archive/2008/07/17/2663777.aspx2. How to write DLL and use DLL
http://www.ibm.com/developerworks/cn/linux/sdk/dll/index.html3. 在linux下编写动态链接库的步骤
http://blog.chinaunix.net/u3/97568/showart_2046606.htmldlopen -- load dll file to memory
dlerror -- return load failure root cause
dlsym - load function pointer from certain
dll in memory
dlclose - release dll file from memory4. A very simple case
http://bbs.loveunix.net/viewthread.php?tid=24316而在linux下 没有那么麻烦 下面给出例子
//dll.c mushuang 2004/03/24 #include <stdio.h> void print_dll() { printf(" call dll success\n"); } CODE //call.c mushuang 2004/03/24 extern void print_dll(); int main() { print_dll(); return 0; } CODE all:libdll.so call libdll.so:dll.c $(CC) -fPIC -shared -o $@ $< call:call.c $(CC) -L. -ldll call.c -o call 运行 LD_LIBRARY_PATH=. ./call 在linux下 不需要特别的修饰符 同样 编译动态库时 也不会生成静态库用于导入 在链接时 直接与动态库连接 十分简单 动态库只要使用-fPIC -shared就可以了 fPIC告诉编译器生成与位置无关代码 -shared表示生成动态库 后面的执行 因为默认的动态库查找路径不包括当前目录 所以使用LD_LIBRARY_PATH告诉shell到当前目录下查找库 很简单 不是吗 [code]
相关文章推荐
- How to use virtual path providers to dynamically load and compile content from virtual paths in
- How can I force Python's file.write() to use the same newline format in Windows as in Linux (“\r\n”
- How to build & install GLFW 3 and use it in a Linux project
- How&nbsp;to&nbsp;check&nbsp;ip&nbsp;address&nbsp;in&nbsp;linux
- How to use virtual path providers to dynamically load and compile content from virtual paths in
- how to write a DLL/SO in C/C++ for Python
- How to let "test2.c" use the variable in "test1.c"
- How to use logrotate to manage log files in linux(如何在Linux中使用logrotate去管理日志文件)
- how to use usb device in linux version 3.00.14(1)-release (i386-redhat-linux-gnu)
- How To Install Programs In Linux (.gz &.bz & RPM)
- How to use Yum package installer in linux?
- (转)How to use udev for Oracle ASM in Oracle Linux 6
- How&nbsp;to&nbsp;Use&nbsp;MMC/SDC——翻译
- how to use writeUTF & writeUTFBytes
- How to use "man" effectively in the development of Linux
- How to Use Linux Commands in Windows with Cygwin
- How&nbsp;to&nbsp;Use&nbsp;MMC/SDC——翻译
- How to configure samba server in Linux Print
- How to use C programing language in Linux as a expert[ZT]
- HowTo use linux laptop in presentations 【如何在Linux系统上使用投影仪】