dll制作时的问题(100)

  • 主题发起人 主题发起人 thincoder
  • 开始时间 开始时间
T

thincoder

Unregistered / Unconfirmed
GUEST, unregistred user!
各位富翁好,学习制作dll文件,将例子中的代码重新敲入,编译时出现错误,分析之后也没有找出原因,请教各位高手。代码如下:library MyDll;{ 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, Dialogs, windows; function Triple(N:Integer):integer;stdcall; begin result:=N+3; end; function Double(N:Integer):integer;stdcall; begin result:=N+2; end; function Triple1(N:Integer):integer;stdcall; begin showmessage('计算N+3'); result:=N+3; end; function Double1(N:Integer):integer;stdcall; begin messagebox(0,'计算N+2','计算N+2',mb_OK); end; exports Triple name 'Tr', Double name 'Do', Triple1 name 'Trm', Double1 name'Dom'; Triple,Double,Triple1,Double1;{$R *.res}beginend.出现的错误提示是:[Error]Project1.dpr[41]:Delaration expected but identifier 'Triple'found我检查以后发现函数Triple也定义了,也没有写错啊,不知为何出现这样的错误,感谢高手帮助。谢谢。
 
exports Triple,Double,Triple1,Double1;
 
exports Triple name 'Tr', Double name 'Do', Triple1 name 'Trm', Double1 name'Dom';{$R *.res}
 
非常感谢szhcracker,tandxu,也就是说我写的exports 之后的函数名称是重复了吧,是的我再次编译之后没有出现那样的错误,但是又出现了:[Error]File not found "MyDll.res";不知为何了,
 
没有找到资源文件,不要具体指定,可以这样{$R *.res},注释也可以
 
如果注释的话应该是这样了。。。//{$R *.res}beginend.这样试过之后可以编译只出现了一个警告,没有出现错误。但是对雨调用dll会有影响吗?
 
没有多少影响,D编译时经常会有警告,部分可以忽略
 
非常感谢szhcracker tandxu andrew :)
 
后退
顶部