易截截图软件、单文件、免安装、纯绿色、仅160KB

linux 下动态库、静态库嵌套使用

linux下静态库嵌套使用
前提是你会在linux下调用静态库和动态库和Makfile编程(当然不会Makfile直接在终端命令也成)
本例是先由StringLen.h,StringLen.c生成librak.a
然后利用StringLen2.h,StringLen2.并调用librak.a生成librak2.a
最后利用StringLen3.h,StringLen3.c调用librak2.a 生成librak3.so
--------------------------------------------------------------------------------------
#StringLen.h:
#ifndef _STRINGLEN_H__
#define _STRINGLEN_H__
int Strlen(char *pStr);
#endif
#StringLen.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen.h"
int  Strlen(char  *pStr)
{        
    unsigned  long  ulLength;
    assert(NULL  !=  pStr);
    ulLength  =  0;
    while(*pStr++)
    {                
        ulLength++;
    }
    return  ulLength;
}
gcc -Wall -c *.c
ar rc librak.a *.o
------------------------------------------------------------------------------------
#StringLen2.h:
#ifndef _STRINGLEN_H2__
#define _STRINGLEN_H2__
#ifdef __UDT
#include "StringLen.h"
#endif
int Strlen2(char *pStr);
#endif
#StringLen2.c:
#include<stdio.h>
#include<assert.h>
#include "StringLen2.h"
int  Strlen2(char *pStr)
{        
    unsigned  long  ulLength;
    #ifdef __UDT
    ulLength  =  Strlen(pStr);
    #else
        ulLength = -1;
    #endif
   
    return  ulLength;
}
gcc -Wall -c *.c -D__UDT
ar rc librak2.a *.o
------------------------------------------------------------------------------------


相关文档:

Linux Shell 命令 简介

安装openssh 服务端
sudo apt-get install openssh-server openssh-client
 
windows 下客户端
puTTY
  
 
常用命令:
 
一.Ls 查看目录命令
一般放在home 目录下
Ls –l /  根目录下的列表
Ls –a /  根目录下所有的文件
Ls –la  组合的选项
Ls &n ......

提高Linux管理效率的三个技巧


管理员想要提高Linux管理效率是要遵循一些管理技巧的,这里简单介绍有关Linux管理效率的三个技巧:卸载无响应的 DVD 驱动器、恢复出现问题的屏幕、屏幕协作。相信他们会对管理员效率有提高。
技巧 1:卸载无响应的 DVD 驱动器
网络新手的经历:按下服务器(运行基于 Redmond 的操作系统)DVD 驱动器上的 Eject 按钮时, ......

Book Note: Linux Device Driver Dos and Don'ts

Book Note: Linux Device Driver Dos and Don'ts
http://janitor.kernelnewbies.org/docs/driver-howto.html
what a hardened (robust) device
driver should mean and how it should be implemented and measured.
1.3 Robust device drivers
-Follows the Linux CodingStyle.
-Efficient in managing faults and ha ......

将Linux代码移植到Windows的简单方法(2)

经过上述的几个步骤。第一个目标,代码能够编译通过基本上是不会有什么问题的。只要把握好二个修改代码的基本原则,第一。引入新的代码,而不修改原有的代码。在没有办法进行调试前修改源代码是不允许的,修改的不好就会引起最后代码运行逻辑的混乱,而且在代码能够运行之前是很难发现问题的。所以除非非常有把握,否则不要 ......

linux下ntp实现

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define NTP_SERVER "clock.via.net"
#define ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号