简单的动态连接库,例子

首先,我们知道VC的三种Dll分别是

1.non_MFC Dll

2.MFC Regular Dll

3.MFC Extension Dll

 

平时我们使用在代码中的:

#pragma comment(lib,"Test_of_dll.lib")


的意思是指文中生成的obj文件应该与Test_of_dll.lib一起链接.或者可以在VC的工程中设置加载此lib

 

下面,来做一个简单动态Dll

新建一个Win32 Application,application setting中勾选Dll,完成.添加如下文件后,编译链接.

 

lib.h文件如下:

#ifndef LIB_H
#define LIB_H
extern "C" int __declspec(dllexport)add(int x,int y);
#endif


lib.cpp文件如下:

#include"stdafx.h"
#include"lib.h"

int add(int x,int y)
{
	return x + y;
}


之后另外新建一个工程,调用此工程生成的Dll,Test_of_nonMFCdll.dll

代码如下:

// Test_of_dllCall.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include"stdio.h"
#include"windows.h"

typedef int(*lpAddFun)(int, int);	//宏定义函数指针类型


int _tmain(int argc, _TCHAR* argv[])
{
	HINSTANCE hDll;		//Dll句柄
	lpAddFun addFun;	//函数指针
	hDll=LoadLibrary("..\\..\\Debug\\Test_of_nonMFCdll.dll");

	if(NULL!=hDll)
	{
		addFun=(lpAddFun)GetProcAddress(hDll,"add");

		if(NULL!=addFun)
		{
			int  result = addFun(2, 3);
			printf("The result of addFun is %d \n",result);
			getchar();
		}


		FreeLibrary(hDll);
	}
	return 0;
}


注意其中的路径,要根据Dll所在做变化,不然找不到相应的Dll:

hDll=LoadLibrary("..\\..\\Debug\\Test_of_nonMFCdll.dll");


调用后的结果:

The result of addFun is 5


 

 

 

转载于:https://www.cnblogs.com/wuyida/archive/2012/08/21/6301492.html

HD2010操作说明(HD2010 operating instructions) ⅰ.软件安装(Installed software) 双击光盘HD2010 V2.0目录下的安装文件图标 ,将控制系统安装到个人电脑.如下图2-1 (Open Profile HD2010 V2.0 in the compact disk,Dblclick Installed the HD2010 V2.0 in your personal computer.As shown in Figure 2-1) 图(Figure)2-1 点击确定后进入下一步如图2-2 (Click确定intro- next step.As shown in Figure 2-2 ) 图(Figure)2-2 点击下一步后进入下一步(英文环境)在中文环境直接点击下一步完成安装)如图2-3 2-4 2-5 2-6 2-7 (Click next intro- next step.As shown in Figure 2-3 2-4 2-5 2-6 2-7) 图(Figure)2-3 注意:发送的文件保存在安装目录下的ProjFile文件夹里,点击下一步完成安装 (Announcements:The file what you send saved in the ProjFile in path of Install.And click next to install and finish) 图(Figure)2-4 图(Figure)2-5 图(Figure)2-6 安装最后一步如图2-7 (The final step of install. As shown in Figure 2-7) 图(Figure)2-7 点击完成打开软件主界面如图2-8 (Click finish open main interface of the software. As shown in Figure 2-8) ⅱ.软件设置(Setting software) ⅱ.ⅰ主界面如图2-8(Main interface.As shown in Figure 2-8) 图(Figure)2-8 ⅱ.ⅱ软件属性(Software properties) 1.文件菜单(File menu) a.新建--新建一个新的显示屏(New—Create a new screen) b.打开--打开一个显示屏(Open—Open a exist screen) c.保存--保存建立的文件(Save—Save file) d.另存为--保存副本(Save as—save a copy) e.导出.hds--导出.hds文件,用于u盘读取文件 (Export.hds—Export.hds file,for usb reading) f.退出--退出软件(Exit—Exit the software) 2.设置菜单(Settings menu) a.屏参设置--设置显示屏属性 (Screen settings—Display Screen configuration attributes) b.通信设置--通信端口/方式设置 (Communication settings—Set Communication prot and fashion) c.系统设置--配置系统默认项 (System settings—Set the acquice properties of software) 3.操作菜单(Operate menu) a.发送项目--发送节目(Send project—send the programmes) b.导出到U盘--把节目导入到U盘 (Export to U disk—send the programme to your U disk) c.时间设置--时间校对 (Time setting—get the right time im your computer) d.亮度设置--选择亮度模式 (Luminance setting—Choice the module of Luminance) e.固件更新--固件升级(Update Firmware—Update your controller Firmware) 4.语言菜单(Language menu) a.简体中文(Simplified Chinese) b.繁体中文(Chinese Traditional) c.英语(English) ⅱ.ⅲ节目编辑(Edit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值