怎么写dll?(20分)

  • 主题发起人 主题发起人 zyx1122
  • 开始时间 开始时间
Z

zyx1122

Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi的帮助中怎么找不到一个写dll的列子
:(
 
先做成From(好调试),然后改成DLL,很简单的!改成这样的就行了!
library Inv;//Inv是单元名
uses
SysUtils,
Classes;
//函数
exports
InvPrint ;//是函数名
begin

end.
 
http://lib.cqu.edu.cn/pcbook/FILES/PRO-DEPHI-EXPLOIN.htm
看第九章你会有很大收获的
 
打开delphi file===>new===>dll

library Project2;

{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }

uses
SysUtils,
Classes;

begin
function myfun
{ .........

}



exports//引出函数
myfun
end.
 
to:djwsea
//函数
exports
InvPrint ;//是函数名
既然是一个form,既是一个对象,不是函数

to:我是一只小小鸟
要删除begin才可以编译通过
 
这是我改的源程序,没问题!就改成这样!
library Invoice;
uses
SysUtils,
Classes;
{$R *.res}
function InvoicePrint(...) : Boolean ;stdcall;
begin
end;
exports
InvoicePrint ;

begin

end.
 
示例代码及文档:
http://www.eFile.com.cn/eFile/jxcjsh/Demos/CreateDll.rar
 
不好意思 我没编译 是要删了begin
 
多人接受答案了。
 
后退
顶部