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.你想将库共享给其他人,但不想让 ...
随机推荐
- hdu_3341_Lost's revenge(AC自动机+状态hashDP)
题目链接:hdu_3341_Lost's revenge 题意: 有n个模式串,一个标准串,现在让标准串重组,使得包含最多的模式串,可重叠,问重组后最多包含多少模式串 题解: 显然是AC自动机上的状态 ...
- 前台javascript排序
<script type="text/javascript"> $(function () { $('.Sorthead-ShowUp').click(function ...
- MySQL事务内幕与ACID
MySQL的事务实现严格遵循ACID特性,即原子性(atomicity),一致性(consistency),隔离性(isolation),持久性(durability).为了避免一上来就陷入对ACID ...
- HttpServletResponse应用----生成验证码
1.1生成随机图片用作验证码 生成图片主要用到BufferedImage类 package gacl.response.study;import java.awt.Color;import java. ...
- C# 调用C++ DLL 的类型转换
//C#调用C++的DLL搜集整理的所有数据类型转换方式,可能会有重复或者多种方案,自己多测试 //c++:HANDLE(void *) ---- c#:System.IntPtr //c++:Byt ...
- mongoDB6--查询表达式
接上一篇总结<深入查询表达式1>上一篇我们介绍了mongodb的一些表达式的深入应用.可能大家觉得有些指令比较难记,下面给大家介绍一些简洁的表达式.给大家介绍的是以下两个指令:分别是$wh ...
- 如何用脚本快速修改IP地址(Netsh)
如何用脚本快速修改IP地址(Netsh) 如果通过Windows的网络属性修改Ip/网关,真是太麻烦了.最近一个项目经常要切换ip,所以我写了两个脚本:c:\116.bat netsh interfa ...
- OC-之AFNetworking
AFNetworking介绍与用法: http://cocoadocs.org/docsets/AFNetworking/2.4.1/index.html
- C语言_用if```else语句解决奖金发放问题
#include<stdio.h> #include<stdlib.h> /*企业发放的奖金根据利润提成,发放规则如下: 利润(I)低于或等于10万元时,奖金可提10%: 利润 ...
- WEB 端批量移动设备管理控制工具 STF 的环境搭建和运行
最近项目涉及到较多设备批量管理的需求,发现一工具,可以批量对大量设备进行WEB端管理,工具主页:https://openstf.github.io/工具名STF(Smartphone Test Far ...