How to access delphi function in DPR area

I have a problem servicing an old Delphi program (D7). Most of the program logic is in a DPR file (this is not a window program), and some devices provide features such as access to the database. We need to get debugging from the database block, but the debugging functionality is in DPR. We cannot easily deprive debugging functionality because it uses material unique to DPR, as well as its main channel. Separating it would be like trying to separate spaghetti and meatball sauce.

So, what do we call a function declared in the DPR domain from a slave? What is equivalent to :: operator in C ++?

Please do not tell me to reverse engineer the application. I would love to, but they will not give us the necessary time. Plus, if we reverse engineered this puppy, it would not be in Delphi.

+5
source share
4 answers

You can declare a method variable in a module that matches the function signature in DPR. At the very beginning of the program, you set the method variable to a function. Inside the device, you call the method variable.

Example:

(SNP)

uses
  Unit1;

function DoSomething(Par: Integer): Integer;
begin
...
end;

...
begin
  DoSomethingVar := DoSomething;
  ...
end;

(unit)

unit Unit1;

interface
...
var
  DoSomethingVar: function(Par1: Integer): Integer;
...
implementation
...
  SomeResult := DoSomethingVar(SomeParameter);
...
+14
source

You can not. The hierarchy of units is rigid.

Two options are possible:

  • .dpr . , . createform *, , , , , .
  • (, , functionpointer C), , .dpr, .
+4

, .dpr , , .dpr , / .dpr .

+3

.dpr - .

, / .

If necessary, you can prefix the device name to access the function / procedure.

If a function / procedure belongs to a specific class, you need to create an instance to access the function / procedure, since it is a method.

In any case, Delphi uses the pascal object as its core, you can access any necessary method / procedure / function / property with the legal concepts of pascal and the concepts of pascal objects.

No matter which file you need to call, and only one other than a decal file for some external library.

0
source

All Articles