linux使用下使用动态与静态库
感觉对这个有些晕,做了个实验,弄清楚了。
实验思路,用同一份代码编译同时生成动态和静态库,通过测试程序调用,看调用的是动态库还是静态库。
生成静态库代码:
/***********hellod.h*************/
#ifndef _HELLO_S_H
#define _HELLO_S_H
void prints(char *str);
#endif
/*hellod.c*/
#include "hellod.h"
#include <stdio.h>
void printd(char *str)
{
printf("print in static way:%s",str);
}
gcc -c -o hellod.o hellod.c
ar cqs libhellod.a hellod.o
生成的静态库为libhellod.a
生成动态库代码:
将上面hellod.c中的打印语句,打印输入:print in dynamic way。以示区别。
gcc -shared -o libhellod.so hellod.c
生成的动态库为libhellod.so。
测试代码main.c
#include "hellod.h"
int main(void)
{
char *text = "hello,world\n";
printd(text);
}
使用静态库:gcc -o hello main.c -static -L./ -lhellod
执行生成文件,打印:print in static way:hello,world
使用动态库: gcc -o hello main.c -L./ -lhellod
执行后,打印 print in dynamic way:hello,world
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
引导 Linux® 系统的过程包括很多阶段。不管您是引导一个标准的 x86 桌面系统,还是引导一台嵌入式的
PowerPC® 机器,很多流程都惊人地相似。本文将探索 Linux
的引导过程,从最初的引导到启动第一个用户空间应用程序。在本文介绍的过程中,您将学习到各种与引导有关的主题,例如引导加载程序、内核解压、初始
RA ......
注:以下内容转自:
http://blog.chinaunix.net/u2/81965/showart_1674967.html
国内站点:
ftp://ftp.altera.com/outgoing/release/
http://www.china-vision.net/blog/user1/6/archives/2006/200696114213.html
http://mail.google.com
shao_华恒公司的主页,里面有很多的相关资料,有待大家去发现
......