我有一個包含名爲「Container.Pas」的子單元的「Utilities.DPR」庫。在「Utilities.DPR」庫中有一些功能。我可以使用在Container.pas中定義和聲明的函數,並調用它的Library.dpr單元。但是我也想使用庫單元中的一些功能。如何在其單元中使用庫函數
library Utilities;
{ 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
System.SysUtils, System.Classes, windows, Winapi.Messages, System.Variants, Vcl.Graphics, Vcl.Controls,
Vcl.Forms, Vcl.Dialogs,System.NetEncoding, Vcl.StdCtrls,
DCPcrypt2, DCPblockciphers, DCPblowfish, DCPsha256, IdGlobal,
Types, Soap.EncdDecd, IdCoder,IdCoderMIME, LbCipher, Winsock,
DateUtils,
container in 'container.pas' {frmContainer};
{$R *.res}
var
s,n,Temp:widestring;
length_:integer;
function bitshifter(Const TestStr:WideString):Boolean;
begin
....
....
end;
和
unit container;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Def,
LbClass,DateUtils;
type
TfrmContainer = class(TForm)
FDSQLiteFunc: TFDSQLiteFunction;
SQLiteConn: TSQLConnection;
FDSQLiteRTree: TFDSQLiteRTree;
FDSQLiteBkp: TFDSQLiteBackup;
SQLQuery: TSQLQuery;
FDSQLiteValidate1: TFDSQLiteValidate;
FDLocalSQL1: TFDLocalSQL;
FDConn: TFDConnection;
FDQuery1: TFDQuery;
FDSQLiteSec: TFDSQLiteSecurity;
FDGUIxWaitCursor1: TFDGUIxWaitCursor;
FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
procedure FDSQLiteValidate1Progress(ASender: TFDPhysDriverService;
const AMessage: string);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function CheckSQLiteDLL:boolean;
function CheckAllowed(const s: string): boolean;
var
frmContainer: TfrmContainer;
implementation
procedure TfrmContainer.FormCreate(Sender: TObject);
begin
//Connection should be created once only)
bitshifter('Hello');
....
end;
歡迎來到StackOverflow!請更具體地說明你的問題。例如。如果你需要訪問'bitshifter',你必須'輸出'它,然後通過聲明爲'external'來導入 –