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. mac 上面安装mysql-python

    安装过程中一直报错: EnvironmentError: mysql_config not found 最终下面的方式解决: 58down voteaccepted +200 Ok, well, fi ...

  2. MVC3+EF4.1学习系列(六)-----导航属性数据更新的处理

    通过上一篇的学习 我们已经知道怎么查询关系 这篇就来说说怎么导航属性数据更新时的处理 以及EF又会为我们生成哪些SQL~ 老规矩 先看下今天的图 添加和修改页面基本就是这样 这节的内容相对简单~~ 主 ...

  3. hdu 1407 测试你是否和LTC水平一样高

    Description 大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上! 你的任务是: 计算方程x^2+y^2+z^2= num的一个正整数解.  Inpu ...

  4. Java 算法

    1.简单的冒泡排序 //冒泡算法一共两种 // -----冒泡算法(1) int a[]={23,69,4,58,1,20}; for (int i = 0; i < a.length-1; i ...

  5. 网络通信框架Apache MINA

    Apache MINA(Multipurpose Infrastructure for Network Applications) 是 Apache 组织一个较新的项目,它为开发高性能和高可用性的网络 ...

  6. 2015 Multi-University Training Contest 10

    1001 CRB and Apple 1002 CRB and Candies 1003 CRB and Farm 1004 CRB and Graph 1005 CRB and His Birthd ...

  7. C# 二维数组和集合

    本次课我主要学习了二维数组和集合的部分内容. 在二维数组的部分中,我主要学习了二维数组的定义方法:int [,] array=new int [4,2];做了一个小练习:用二维数组打印自己的姓氏. s ...

  8. 调用CImg库显示WAV格式音频波形

    最近在做傅里叶变换和小波变换时经常要通过显示波形来检验算法,但通过visual studio之类显示波形又显得麻烦,而且不能跨平台. CImg是一个跨平台的C++的图像处理库,提供的图像处理等功能十分 ...

  9. linker command failed with exit code 1 (use -v to see

    转自 :http://www.reader8.cn/jiaocheng/20131022/2003334.html Undefined symbols for architecture http:// ...

  10. Spring 表单提交,后台自动封装有集合对象的对象

    from表单: <form action="${pageContext.request.contextPath}/vote/save" method="post&q ...