静态连接库和动态连接库

静态链接库和动态链接库导出函数详解,这个文章不错

http://www.360doc.com/content/11/0805/17/6675409_138289992.shtml

 

静态链接库

应该只是一些2进制的实现。当我们重写静态链接库中的函数,可能就会去执行后来实现的,具体为什么不太清楚啊。。=。=

 

静态链接库内容如下:

ying.h

int fun(int a, int b);

 

ying.cpp

#include <iostream> #include "ying.h"

int fun(int a, int b) {  return a + b; }

 

使用该lib库时

#include <iostream>

#include "ying.h"

using namespace std;

int fun(int a, int b);

// int fun(int a, int b)

// {

//  return a - b;

// }

void main() {  cout<<fun(3, 2)<<endl; }

 

注释掉上面减法实现 输出结果是5,否则是1

 

posted @ 2014-08-03 23:51  YinaPan  阅读(168)  评论(0编辑  收藏  举报