初学编DLL,为何我的DLL总是100多K,如何才能改小?(50分)

  • 主题发起人 主题发起人 albb1234
  • 开始时间 开始时间
A

albb1234

Unregistered / Unconfirmed
GUEST, unregistred user!
附:
library MY;

{ 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;

Function MyADD ( X , Y : integer ) : integer ;
stdcall ;
begin

Result :=x+y;
end;


Function MyJ ( X , Y : integer ) : integer ;
stdcall ;
begin

Result :=x-y;
end;


Function MyS ( X , Y : integer ) : integer ;
stdcall ;
begin

Result :=x*y;
end;


{$R *.res}
exports
MyADD,MyJ,MyS;
begin

end.


编译出来要100多K,这是怎么回事?
 
delphi的架构造成的. 有许多额外的东西在里面. 就像用vcl做一个简单的hello world程序也要几百k一样.
 


uses
SysUtils,
Classes;

去掉再编译就变小了。
 
不必要的單元無需加進去。
 
接受答案了.
 
后退
顶部