dll程式源碼為:
頭檔案:
#ifndef UNIT1H
#define UNIT1H
extern "C" __declspec(dllexport) __stdcall void messbox();
#endif
cpp檔案:
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "unit1.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//---------------------------------------------------------------------------
void __stdcall test()
{
}
make後,把生成的DLL放入了system32目錄下。
然後在查詢分析器裡執行:
sp_addextendedproc 'test' , 'Project1.dll'
exec test
注意:SQL調用擴充存儲過程不能有與使用者互動的資訊(因為是不可能彈出任何視窗的)