Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading a Delphi Object Run Time using BPL
    primarykey
    data
    text
    <p>I have a class in a unit. Usually, when I changed the algorithm of its methods, I have to recompile it and deliver the patch as a whole. I think to create the instance of the class using DLL. After searching in delphi.about.com, I found that instead of using DLL, I can use BPL. It is a DLL for Delphi. The problem is almost all examples I found is only telling how to export a function. I want to dynamically load the BPL, and whenever I replace the BPL, I can get the latest algorithm of the class, not only the functions I export.</p> <p>Article I have read:<br> - <a href="http://delphi.about.com/od/objectpascalide/a/bpl_vs_dll.htm" rel="nofollow noreferrer">http://delphi.about.com/od/objectpascalide/a/bpl_vs_dll.htm</a><br> - <a href="https://stackoverflow.com/questions/1192734/plugins-system-for-delphi-application-bpl-vs-dll">Plugins system for Delphi application - bpl vs dll?</a><br> - <a href="http://delphi.about.com/library/weekly/aa012301a.htm" rel="nofollow noreferrer">http://delphi.about.com/library/weekly/aa012301a.htm</a></p> <p>Any URL or SAMPLE how to create a BPL from scratch to encapsulate a component or a class is greatly appreciated.</p> <hr> <p>Dear Guru,</p> <p>Suppose I have code like this:</p> <pre><code>unit unitA; interface type B = class(TObject) public procedure HelloB; end; A = class(TObject) public function GetB: B; function HelloA: String; procedure Help; end; implementation uses Dialogs; { B } procedure B.HelloB; begin ShowMessage('B'); end; { A } function A.GetB: B; begin Result := B.Create; end; function A.HelloA: String; begin Result := 'Hello, this is A'; end; procedure A.Help; begin //do something end; end. </code></pre> <p>I want to export all public methods of A. How to make it a DLL? How to use it from another unit where to import it? let's say:</p> <pre><code> var a: A; a := A.Create; a.GetB; showMessage(a.HelloA); </code></pre> <p>A is not declared in the unit (it is in the DLL). Please advise.</p> <hr> <p>Hurray. I got it last night. All I have to do is make the object implement an interface which is used in the caller unit to catch the instance of object returned by the DLL.</p> <p>Thank you all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload