声明函数:
function create_abc(dbs: tdatabase): Tfront;
函数:
function create_abc(dbs: tdatabase): Tfront;
begin
........
end;exportscreate_abc上面为动态链接库。
-----------------------------------------------------------------------------------------------------调用动态链接库函数:
type
TStrFunction=function ():Tfront;stdcall; //function ()参应该怎么写?
procedure TForm1.FormShow(Sender: TObject);
var
Hinst:Thandle;
MyFunct:TStrFunction;
begin
Hinst:=LoadLibrary('E:\aaa.dll');
if Hinst>0 then
try
@MyFunct:=GetProcAddress(HInst,'create_ybjk');
if @MyFunct<>Nil then
begin
MyFunct();
end
else
showmessage('DLL Function not found.');
Finally
FreeLibrary(Hinst);
end
else
ShowMessage(' Library not Found');
end;问题:type
TStrFunction=function ():Tfront;stdcall; 的时候function的返回值怎么写?是dbs:tdatabase吗?如果是的话tdatabase提示识别不了!如果加入其他相关的
单元文件也不行。请问正确的调用格式应该怎么写因为函数的参数是一个TDATABASE。所以参数不好设
function create_abc(dbs: tdatabase): Tfront;
函数:
function create_abc(dbs: tdatabase): Tfront;
begin
........
end;exportscreate_abc上面为动态链接库。
-----------------------------------------------------------------------------------------------------调用动态链接库函数:
type
TStrFunction=function ():Tfront;stdcall; //function ()参应该怎么写?
procedure TForm1.FormShow(Sender: TObject);
var
Hinst:Thandle;
MyFunct:TStrFunction;
begin
Hinst:=LoadLibrary('E:\aaa.dll');
if Hinst>0 then
try
@MyFunct:=GetProcAddress(HInst,'create_ybjk');
if @MyFunct<>Nil then
begin
MyFunct();
end
else
showmessage('DLL Function not found.');
Finally
FreeLibrary(Hinst);
end
else
ShowMessage(' Library not Found');
end;问题:type
TStrFunction=function ():Tfront;stdcall; 的时候function的返回值怎么写?是dbs:tdatabase吗?如果是的话tdatabase提示识别不了!如果加入其他相关的
单元文件也不行。请问正确的调用格式应该怎么写因为函数的参数是一个TDATABASE。所以参数不好设
解决方案 »
- 郁闷贴.... 散分三
- 用Wininet的http上传文件时,如何指定的文件夹不存在,如何才能创建文件夹?
- 嵌套式的常量或者结构定义该如何实现(like subdefine<--define<--application)
- 用FASTREPORT做报表,你们的网格线都是怎么做的啊,不会是划的网格吧?
- 关于TExtraDevices将reportbuilder报表转成pdf的问题
- 就这么两句,为什么内存总在涨,内存泄漏吗?大家帮忙分析分析
- 各位大侠,小弟请问一个问题!!!
- 求【delphi多线程的视频教程,还有服务器和客户端通讯的教程】
- 怎么增加刪除TTListView 的數据呢?和資料庫連接起來用呢?謝謝!
- 关于toolbar的显示和关闭的问题,答对一定给分
- 关于支持刷卡(磁卡)键盘编程支持的相关信息咨询
- 100分求delphi5企业版 联系qq7181418
如果你在实现DLL中,有一个函数是function a() :Tfront ,你就可以定义如此的一个函数指针
他的返回值要跟你DLL中实现的是一样的。DLL中的函数返回值,你的函数指针要与其批配!
这是dll中声明的函数create_abc(dbs: tdatabase)调用的时候也要TYPE是吧?
type
TStrFunction=function ():Tfront;stdcall; //function ()参应该怎么写?
是不是这样?
type
TStrFunction=function (dbs: tdatabase): Tfront;但是Tdatabase这个类是在动态链接库中单元里面的设置。在调用的时候没有这个类