因爲我用我的Delphi應用程序許多幀我的最後一個項目,所以我決定要創建的dll並把它們的動態鏈接庫(Delphi中所有已創建)德爾福exe文件和dll不與運行時包建立
我有內部通過許多網站,並提出了可用的代碼,但對於這個例子,我必須編譯構建與運行包這兩個應用程序和dll,這意味着我必須分發bpls也。如果不要檢查建立與運行軟件包的錯誤來了
這是我在DLL中找到
在EXE
procedure TForm1.Button1Click(Sender: TObject);
type
TGetTheFrame =Function(Owner: TComponent; TheParent: TWinControl): TFrame; stdcall ;
var
GetTheFrame : TGetTheFrame;
begin
try
GetTheFrame(application,TabSheet1).Free ;
except
end;
frm := GetTheFrame(application,TabSheet1) ;
dllHandle := LoadLibrary('project1.dll') ;
if dllHandle <> 0 then
begin
GetTheFrame := GetProcAddress(dllHandle, 'GetTheFrame') ;
frm := GetTheFrame(application,TabSheet1) //call the function
{ ShowMessage('error function not found') ;
FreeLibrary(dllHandle) ; }
end
else
begin
ShowMessage('xxxx.dll not found/not loaded') ;
end
Function GetTheFrame(Owner: TComponent; TheParent: TWinControl): TFrame; stdcall;
Begin
Result := TFrame2.Create(Owner);
Result.Parent := TheParent;
End;
這就是所有的代碼,但我想這個代碼沒有運行時包的工作
但我確定代碼是好的,因爲它與runtimw = e軟件包一起工作 – VibeeshanRC 2010-10-21 12:43:32
第一個GetTheFrame調用的目的是什麼?如果它的目的是做任何事情,而不是隨意地摧毀你的記憶,那麼你就錯了。編譯器應該警告你在那裏使用一個未初始化的變量。 – 2010-10-21 12:50:32
在你之前的問題中看到我的答案:http://stackoverflow.com/questions/3985256/how-to-use-delphi-dlls-without-enabling-build-with-runtime-packages我認爲這個問題是重複的。 – 2010-10-21 12:52:36