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的更多相关文章

  1. 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 ...

  2. iOS制作Static Library(静态库),实现多工程的连编

    在iOS开发中,我们会发现一些偏底层或基础代码是直接可以复用的,当我们换一个项目,改变的只需要是偏上层的业务逻辑代码,所以我们可以把这部分基础代码制作为一个静态库static library,并不断扩 ...

  3. 创建静态库Static Library(Framework库原理相似)

    在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 简介: 库是一些没有ma ...

  4. 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 ( ...

  5. iOS 元件组件-创建静态库static library

    概述 在项目开发的过程中,经常使用静态库文件.例如两个公司之间业务交流,不可能把源代码都发送给另一个公司,这时候将私密内容打包成静态库,别人只能调用接口,而不能知道其中实现的细节. 库是一些没有mai ...

  6. 使用Xcode 5创建Cocoa Touch Static Library(静态库)

    转自:http://blog.csdn.net/jymn_chen/article/details/21036035 首先科普一下静态库的相关知识: 程序编译一般需经预处理.编译.汇编和链接几个步骤. ...

  7. 区别: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 ...

  8. 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 ...

  9. ios中静态库的创建和使用、制作通用静态库(Cocoa Touch Static Library)

    创建静态库可能出于以下几个理由: 1.你想将工具类代码或者第三方插件快捷的分享给其他人而无需拷贝大量文件.2.你想让一些通用代码处于自己的掌控之下,以便于修复和升级.3.你想将库共享给其他人,但不想让 ...

随机推荐

  1. Queues 队列

    1. Definiation What is a queue? A queue is a list. With a queue, inseration is done at one end (know ...

  2. Struts2配置文件动态传参

    两个Action动态传递参数: 1.从一个Action传递到另一个Action如果带有参数那么result中的type属性需要使用redirect 第一个Action代码如下: private Str ...

  3. hitTest:withEvent:方法流程

    此方法可实现点击穿透.点击下层视图功能. 一. hitTest:withEvent:调用过程 iOS系统检测到手指触摸(Touch)操作时会将其放入当前活动Application的事件队列,UIApp ...

  4. 屏幕录像专家2014 v0318 免费版

    软件名称: 屏幕录像专家2014软件语言: 简体中文授权方式: 免费试用运行环境: Win8 / Win7 / Vista / WinXP软件大小: 7.9MB图片预览: 软件简介:屏幕录像专家201 ...

  5. 关于UIFont和计算字符串的高度和宽度

    转自:http://i.cnblogs.com/EditPosts.aspx?opt=1 1.创建方法:+ fontWithName:size:- fontWithSize:2.创建系统字体:+ sy ...

  6. 4. JavaScript 控制语句

    1. If...Else 语句 1.1 条件语句if /* 格式: 1. if ... 2. if ... else ... 3. if ... else if .... else 4. switch ...

  7. 在VS中生成后拷贝文件

    环境:win7_64旗舰版,VS2013 工作项目中,一般会使用第三方库,当修改并重新编译第三方库后,需要将DLL文件拷贝到工作项目下的生成目录中,每次手动拷贝比较繁琐,VS提供自定义生成事件,允许我 ...

  8. POJ 2418 Hardwood Species (哈希,%f 和 %lf)

    我的错因: 本来改用%f输出,我用了%lf,结果编译器直接判定为错误(一部分编译器认为lf是没有错的).当时我还以为是hash出错了.. 方法不止一种: 方法 时间   空间 Hash 891ms 5 ...

  9. jQuery实现的简单分页功能的详细解析

    分页功能在项目开发中不可或缺,老司机操作起来就和呼吸一样简单,新手恐怕就会吃力一些. 今天我回顾了一下具体的操作步骤,决定详细的分析一下每一步的实现目的及原理. 我们会创建一个简单的json文件来模拟 ...

  10. linux同步windows的时间

    找了很多的资料,都没有windows做时间服务,linux同步windows的时间的,最后自己找了一些软件,终于搞定了,写出来给大家共享,以免大家多走弯路 首先在http://www.meinberg ...