B
bronzestar
Unregistered / Unconfirmed
GUEST, unregistred user!
编写DLL时想通过条件编译的方法随时改变project是exe还是DLL。好像行不通,去掉DLL定义后在Delphi中虽能生成*.exe文件但run时总提示要HostName!Why?;
工程文件如下:
{$IFDEF DLL}
Library salChangedEX;
{$ELSE}
program salChangedEx;
{$ENDIF}
uses
{$IFDEF DLL}
SysUtils,
Classes,
{$ELSE}
Forms,
{$ENDIF}
...;
{$R *.res}
{$IFDEF DLL}
Exports
ExChange;
{$ENDIF}
begin
{$IFNDEF DLL}
Application.Initialize;
...
Application.Run;
{$ENDIF}
end.
工程文件如下:
{$IFDEF DLL}
Library salChangedEX;
{$ELSE}
program salChangedEx;
{$ENDIF}
uses
{$IFDEF DLL}
SysUtils,
Classes,
{$ELSE}
Forms,
{$ENDIF}
...;
{$R *.res}
{$IFDEF DLL}
Exports
ExChange;
{$ENDIF}
begin
{$IFNDEF DLL}
Application.Initialize;
...
Application.Run;
{$ENDIF}
end.