我把数据保存到数据库的过程写了个dll,想请大家帮忙看看有没有不妥当的地方.如果多个线程调用它是否会引发内存出现问题,我现在的程序运行后总按相近的步长增长占用内存,因为程序要24小时运行,这样下去会完蛋的.是否调用这个dll有问题,很希望得到大家的帮助.
//---------------------------------------------------------------------------
#include
#include "StoredProcess.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
CoInitialize(NULL);
break;
case DLL_PROCESS_DETACH:
CoUninitialize();
break;
}
return 1;
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport) void __stdcall IV_RealStored(char *DevProviderName,const DynamicArray& DevInfo)
{
dm_Stored=new Tdm_Stored(NULL);
dm_Stored->StoredProc_CDS->ProviderName=AnsiString(DevProviderName);
dm_Stored->StoredProc_CDS->Params->Clear();
for(int i=0;i<=DevInfo.Length;i++)
{
dm_Stored->StoredProc_CDS->Params->Add();
if(i==0)
dm_Stored->StoredProc_CDS->Params->Items[0]->AsDateTime = DateTimeToStr(Now());
else
dm_Stored->StoredProc_CDS->Params->Items[i]->AsInteger=DevInfo[i-1];
}
dm_Stored->StoredProc_CDS->Execute();
delete dm_Stored;
}
--------------------next---------------------
阅读(1647) | 评论(0) | 转发(0) |