#define DEMO_API extern "C" __declspec(dllexport) #else #define DEMO_API extern "C" __declspec(dllimport) #endif DEMO_API int AddNumber(int a, int b); // Demo.cpp源文件 #include "Demo.h" DEMO_API int AddNumber(int a, int b) return a + b;

编译之后,生成动态链接库Demo.dll

2.NSIS脚本调用

首先将生成的Demo.dll拷贝在目录NSIS的安装目录Plugins下,编写的NSIS脚本如下:

OutFile "UseDLL.exe"
ShowInstDetails show
Section ""
	push "100"
	push "200"
	pop $0
	pop $1
	Demo::AddNumber $0 $1
	pop $2
DetailPrint "$0+$1=$2"
SectionEnd

点击生成的安装包UseDLL.exe如下:
在这里插入图片描述

NSIS可以和C/C++混合编程,就是通过NSIS脚本加载C/C++的动态库。1.首先创建动态库如下:// Demo.h文件#ifdef DEMO_EXPORTS#define DEMO_API extern "C" __declspec(dllexport)#else#define DEMO_API extern "C" __declspec(dllimport)#endifD...
refprop调用的一些说明。REFPROP is based on the most accurate pure fluid and mixture models currently available. It implements three models for the thermodynamic properties of pure fluids: equations of state explicit in Helmholtz energy, the modified Benedict-Webb-Rubin equation of state, and an extended corresponding states (ECS) model. Mixture calculations employ a model that applies mixing rules to the Helmholtz energy of the mixture components; it uses a departure function to account for the departure from ideal mixing. Viscosity and thermal conductivity are modeled with either fluid-specific correlations, an ECS method, or in some cases the friction theory method.
System::Call 'F:\Ds40xxSDK::InitDSPs() i().r0' ;初始化芯片,函数: int __stdcall InitDSPs() System::Call 'F:\Ds40xxSDK::GetBoardCount(
NSIS是一个功能强大的安装卸载包制作工具,通过dll可以扩展很多功能,你也可以自定义一个dll,以下是具体步骤: 1.新建一个mfc dll(本例Hello.dll) 1.1 添加对nsis库的引用: 在Hello.cpp中声明对nsis库的引用: // Hello.cpp : 定义 DLL 的初始化例程。 #include "stdafx.h" #include "He
02_NSIS_使用MD5.dll1. md52. 官网例子3.结果展示 1. md5 从官网下载md5.dll,将dll文件放置在NSIS的安装目录下/Plugins文件中, md5可以加密字符串、文字、生成随机数等功能。 2. 官网例子 ;输出文件为md5test.ex OutFile "md5test.exe" ;展示安装细节 ShowInstDetails show Section #生成字符串的MD5sum md5dll::GetMD5String "md5me" Pop $0 //模板例子 void __declspec(dllexport) myFunction(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra