Got Stucked in C++ Static Library Loading.. for some time
I used to load library using 1 single .dll file, so when I happen to do method calling between 2 projects in a solution, I got puzzled..
In the solution, doing method calling between projects is constant, so as far as I can see, the dynamic calling method is onerous. It's also not Okay to call method from the other project directly, that will invoke the unresolved external link error(2001,1014,2011, etc..) during link.
Eventually I found that static calling is the remedy. In this way, you can avoid doing onerous calling that dynamic calling might cause. But the shortcoming is to attach a .lib with the release, making the size larger. Most times .lib files are small in size.
dynamic calling in x86 programs:
//method definition in .dll: type Func(type1 t1, type2 t2);
typedef type (*F)(type1,type2);
HINSTANCE hInst = new LoadLibrary(".dll");
F f = GetProcAddress(
hInst,
"Func"
};
//method name never coincides.
static calling:
//statically calling method
//First, specify the additional c/c++ include directory where func.h is in C/C++ general from project properties.
//Second, if needed, specify the func2.lib file directory in link general from project properties
//func.h
#include "func2.h"//this file contains the function definition
#pragma comment(lib, "func2.lib")//.lib file contains info about method addresses in .dll file
func2();//method calling
Got Stucked in C++ Static Library Loading.. for some time的更多相关文章
- Objective-C categories in static library
ASK: Can you guide me how to properly link static library to iphone project. I use staic library pro ...
- iOS制作Static Library(静态库),实现多工程的连编
在iOS开发中,我们会发现一些偏底层或基础代码是直接可以复用的,当我们换一个项目,改变的只需要是偏上层的业务逻辑代码,所以我们可以把这部分基础代码制作为一个静态库static library,并不断扩 ...
- 创建静态库Static Library(Framework库原理相似)
在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 简介: 库是一些没有ma ...
- Can't debug c++ project because unable to static library start program *.lib
Can't debug c++ project because unable to static library start program *.lib I'm using a library ( ...
- iOS 元件组件-创建静态库static library
概述 在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 库是一些没有mai ...
- 使用Xcode 5创建Cocoa Touch Static Library(静态库)
转自:http://blog.csdn.net/jymn_chen/article/details/21036035 首先科普一下静态库的相关知识: 程序编译一般需经预处理.编译.汇编和链接几个步骤. ...
- 区别:Use MFC In A Shared DLL 和 Use MFC In A Static Library
摘自:Programming Windows with MFC, 2nd Edition Choosing Use MFC In A Shared DLL minimizes your applica ...
- Build fat static library (device + simulator) using Xcode and SDK 4+
155down votefavorite 185 It appears that we can - theoretically - build a single static library that ...
- ios中静态库的创建和使用、制作通用静态库(Cocoa Touch Static Library)
创建静态库可能出于以下几个理由: 1.你想将工具类代码或者第三方插件快捷的分享给其他人而无需拷贝大量文件.2.你想让一些通用代码处于自己的掌控之下,以便于修复和升级.3.你想将库共享给其他人,但不想让 ...
随机推荐
- haskell类型
一.源文件 介绍这个主要是因为下文很多代码写在源文件中,然后从ghci加载源文件进行测试. 创建一个文本文件,在其中输入,并保存为add.hs文件 -- file: add.hs add x y = ...
- git 恢复丢失的文件-- 不提交入口文件
务必进入当前controller下面,才能恢复 git checkout HEAD TestController.class.php 01备份index.php文件 02使用 小乌龟的git 删除 t ...
- 放弃阿里云主机,选择高性价比Vultr VPS免备案
阿里云主机ECS推广多年后,质量有所改善,但我依然强烈不推荐阿里云主机.考虑性价比带宽速度等因素后,我推荐的vps品牌有vultr和digitalocean,还有大名鼎鼎的linode,是中国用户的最 ...
- 循环移位法和数据拼接法基于led
功能描述 让led每隔0.5s从两边向中间闪烁,然后在从中间向两边闪烁,不断循环 项目实现 开发板 晶振为50M,那么达到0.5s时计数器count1需要达到24_999_999这么多次数 计数器代码 ...
- 关于oracle数据库(6)约束
约束类型 1.主键primary key(一般是一个表的标志,所以一个表只能有一个主键:主键不能为空,不能重复) 2.唯一键unique(不能重复) 3.外键foreign key 4.检查约束che ...
- Gitlab 安装配置
Gitlab 很好的替代Github,可以安装到公司的内网服务器 进行管理 ,可以分布式的管理,集中的管理 下面介绍安装这个软件的步骤 其实安装很简单的 按照官网可以安装 https://about ...
- nginx安装与应用
一.nginx的安装与启动: 1.安装依赖库.nginx的一些模块需要依赖其他第三方库,通常有pcre库(perl compatible regular expression,perl兼容正则表达式, ...
- iosOC/C不可变数组排序
//1.回顾C数组排序 int a[6] = {1,4,3,5,6,2}; //选择 for (int i =0; i<6-1; i++) { for (int j = i+1; j<6; ...
- mysql常用命令使用技巧
一.连接Mysql格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root - ...
- php curl 获取 HTTPS
注意:谷歌的话开vpn可能才可以,goagent也不行function getHTTPS($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_S ...