静态连接库和动态连接库

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

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

本文由博主(YinaPan)原创或者转载,如若转载请务必注明出处,谢谢合作!
原文地址:https://www.cnblogs.com/YinaPan/p/3889128.html