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. 浙大 pat 1047题解

    1047. Student List for Course (25) 时间限制 400 ms 内存限制 64000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Y ...

  2. 5. Java反射机制

    Java反射机制   问题: 在运行时,对一个JAVA类,能否知道属性和方法:能否调用它的任意方法? 答案是可以的,JAVA提供一种反射机制可以实现. 目录 什么是JAVA的反射机制 JDK中提供的R ...

  3. delphi 集合的用法

    http://blog.sina.com.cn/s/blog_9e2e8405010180jy.html delphi基础补充     1 开域语句     在面向对象的程序代码中,嵌套对象的现象十分 ...

  4. digitalocean vpn安装配置教程

    digitalocean是美国一家专业的vps提供商,优势是性价比高,最低配置512MB内存vps每月只要5美元,导致大陆用户疯狂涌入.关于digitalocean申请方法.digitalocean速 ...

  5. JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍(转载)

    这里是JavaScript中制作滚动代码的常用属性 页可见区域宽: document.body.clientWidth;网页可见区域高: document.body.clientHeight;网页可见 ...

  6. 【python问题系列--4】ValueError: operands could not be broadcast together with shapes (100,3) (3,1)

    背景:dataMatrix是(100,3)的列表,labelMat是(1,100)的列表,weights是(3,1)的数组,属性如下代码所示: >>> import types> ...

  7. SQL 课程 连接查询

    今天,我主要是对前面所学习过的子查询进行了复习,然后学习了连接查询join on 的内容. 如: select renyuan.code,name,age ,sex , bumen.bname,bce ...

  8. 关于dubbo服务产生异常之:Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer.

    简单来说就是dubbo超时,因为dubbo默认的时间是500ms,超过这个时间它会重新访问service层,最多尝试三次. 所以我在测试的时候日志显示出来的异常为……timeout……. 开始设置开始 ...

  9. windows xp sp3 下载地址

      windows xp service pack 3/ windows xp sp3 简体中文版下载地址: http://download.windowsupdate.com/msdownload/ ...

  10. 模板singleton模式的C++实现

    模板singleton模式的C++实现 近期回过头整理了一下singleton模式,看了别人写的关于singleton的介绍.发现这个singleton模式虽然简单,但要写一个稳定/线程安全/泛型的模 ...