显式例子 :
단위 메인;
인터페이스
용도
창, 메시지, 시스템, 변형, 클래스, 그래픽, 컨트롤, 양식,
대화, stdctrls, extctrls, 그리드, dbgrids, db, dbtables, dbctrls;
유형
tform1 = 클래스 (tform)
버튼 1 : tbutton;
edit1 : 테디;
edit2 : 테디;
이미지 1 : 시계;
DataSource1 : Tdatasource;
표 1 : ttable;
표 1speciesno : tfloatfield;
Table1category : tstringfield;
표 1common_name : tstringfield;
표 1speciesName : tstringfield;
Table1lengthcm : tfloatfield;
Table1length_in : tfloatfield;
표 1notes : tmemofield;
Table1graphic : tgraphicfield;
DBGRID1 : TDBGRID;
절차 버튼 1Click (sender : tobject);
사적인
{개인 선언}
공공의
{공개 선언}
끝;
// 함수 getInteger (i : 정수) : 정수; stdcall; 외부 'dllone.dll';
// 함수 getDouble (f : double) : double; stdcall; 외부 'dllone.dll';
tgetDouble = 함수 (f : double) : double; stdcall;
var
form1 : tform1;
구현
{$ r *.dfm}
절차 tform1.Button1click (sender : tobject);
var d : 더블;
dllhandle : thandle;
func : tgetdouble;
시작하다
image1.picture.assign (table1graphic);
table1graphic.assign (image1.picture);
출구;
dllhandle : = loadLibrary ( 'dllone.dll');
노력하다
@func : = getProcadDress (dllhandle, 'getDouble');
//edit1.text : = inttostr (getInteger (2));
// d : = getDouble (2.2);
할당 된 경우 (@func)
시작하다
d : = func (2.2);
edit2.text : = floattostr (d);
끝;
마지막으로
Freelibrary (dllhandle);
끝;
끝;
끝.
隐式例子 :
도서관 dllone;
용도
sysutils,
수업;
{$ r *.res}
함수 getDoubleExt (f : double) : double; stdcall; 외부 'dlltwo.dll';
함수 getint (i : 정수) : 정수; stdcall; 외부 'dlltwo.dll';
함수 getInteger (i : 정수) : 정수; stdcall;
시작하다
결과 : = getint (i);
끝;
함수 getDouble (d : double) : double; stdcall;
시작하다
결과 : = getDoubleExt (d);
끝;
수출
getinteger,
getdouble;
시작하다
끝.
도서관 dlltwo;
{DLL 메모리 관리에 대한 중요한 참고 사항 : Sharemem은
도서관의 사용 절과 프로젝트의 첫 번째 단위 (선택
dll이 절차를 내보내거나 절차를 내보내거나
문자열을 매개 변수 또는 함수 결과로 전달하는 함수. 이것
DLL을 오가는 모든 문자열에 적용됩니다.
기록과 수업에 중첩되어 있습니다. Sharemem은 인터페이스 장치입니다
borlndmm.dll 공유 메모리 관리자,이를 따라 배포해야합니다.
DLL과 함께. borlndmm.dll 사용을 피하려면 문자열 정보를 전달하십시오
PCHAR 또는 단락 매개 변수 사용. }
용도
sysutils,
수업;
{$ r *.res}
함수 getDoubleExt (d : double) : double; stdcall;
시작하다
결과 : = D;
끝;
함수 getint (i : 정수) : 정수; stdcall;
시작하다
결과 : = i;
끝;
수출
getDoubleExt,
getint;
시작하다
끝.