C++通过dll查询数据库,接口已经有了,怎么查询? (c 数据库dll)

调肆橡升用dll有动态调用和静态调用两种方法,我看你的代码基本上是动态调用,那么我就跟你说一下动态调用的方法吧.下面以FanSelect函数为例.

在你的原文件中,按下面的顺序进行:

1.首先要包含必要的头文件,这里要记得包含dll自带的那个头文件.

#include

#include

#include

#include “VSQS.h” /如塌/假如是叫这个名字

using namespace std;

2.定义函数指针,这里要加上__stdcll,请注意.

typedef void (__stdcll *FanSelect)(

void *pSeriesNames,//系列名称 YLDStr * (typedef struct{char Data;} YLDStr;)

const int pSeriesNameCount,//系列名称个数,-1时表示全部选择

void *pSubSeriesNames,//系列名称 YLDStr * (typedef struct{char Data;} YLDStr;)

const int pSubSeriesNameCount,//子系列名称个数,-1时表示全部选择

const double &pFlow, //风量

const int &pFlowUnitType, //风量单位类型 0-m^3/h 1-m^3/s 2-l/s 3-cfm

const double &pPres, //风压

const int &pPresUnitType, //风压单位类型 0-Pa 1-mmH2O 2-kgf/cm^2 3-inH2O

const int &pPresType, //风压类型 0-全压 1-静压

const int &pOutFanType,//出风方式 0-管道出风 1-自由出风

const double &pAirDensity,//空气密度

const double &pMotorSafeCoff,//电裂老机容量安全系数(%)

const bool &pUserSetMotorSafeCoff,//用户设定了电机容量安全系数

double &rFlow_STDUnit,//标准单位下的风量

fun_AddResult pAddResult//函数指针,用于回传数据

);

3.使用函数.代码如下:

int main(int argc, char *argv)

{

HINSTANCE hDll; //DLL句柄

FanSelect Select; //函数指针

hDll = LoadLibrary(“VSQS.dll”);//要注意路径,可以写上dll的详细路径

if (hDll != NULL)

{

cout

Select = (FanSelect)GetProcAddress(hDll, “FanSelect”);

if (Select != NULL)

{

cout

//参入如何传进去?参数直接定义相应的局部变量,带入函数即可.拿之一个参数YLDStr为例

YLDStr test;

test.Data = ‘a’;

test.Data = ‘\0’;

FanSelect( &test, -1, 0, -1, 6000, 0, 800, 0, 0, 0, 1.195, 10, 0, 6000, HD);

cout

}

FreeLibrary(hDll);

}

getchar();

return 0;

}

相关问题拓展阅读:

    c 数据库dll的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于c 数据库dll,C++通过dll查询数据库,接口已经有了,怎么查询?的信息别忘了在本站进行查找喔。


    数据运维技术 » C++通过dll查询数据库,接口已经有了,怎么查询? (c 数据库dll)