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. bzoj1417: Pku3156 Interconnect

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1417 1417: Pku3156 Interconnect Time Limit: 10 ...

  2. poj2140(奇因数的个数)

    #include<stdio.h>int main(){ int n,s=0; scanf("%d",&n); for(int i=1;i<=n;i++) ...

  3. photoshop的页面制作练习2

  4. SpringMVc上传excel或csv文件

    1.JSP页面代码 <form enctype=""multipart/form-data" method="post"> <inp ...

  5. android.telephony.SmsManager 短信笔记

    android 几种发送短信的方法 http://www.oschina.net/question/163910_27409 <uses-permission android:name=&quo ...

  6. linux命令英文缩写的含义(方便记忆)

    命令缩写: ls:list(列出目录内容) cd:Change Directory(改变目录) su:switch user 切换用户 rpm:redhat package manager 红帽子打包 ...

  7. Linux openvswitch性能调优

    Increasing the flow-eviction threshold The threshold is a type of limit on the number of flows that ...

  8. TCP小结

    TCP/IP协议实现了不同主机,不同操作系统之间信息交流.由4层构成,从上往下依次为: 1.应用层,包括http,ftp等协议,用于实现某一项具体的功能. 2.传输层,包括TCP和UDP,一个可靠,一 ...

  9. JPA基本注解介绍

    一.@Entity •@Entity 标注用于实体类声明语句之前, 指出该Java 类为实体类,将映射到指定的数据库表. 如声明一个实体类 Customer,它将映射到数据库中的 customer 表 ...

  10. 【第一篇】学习 android 事件总线androidEventbus之sticky事件的传递

    最近再看eventbus相关代码,首先从使用开始,后期再从源码角度分析eventbus.使用Demo后期公布到github上去. 使用的框架地址:https://github.com/bboyfeiy ...