Home > Back-end >  Easy language "call subroutine" how to implement in Delphi?
Easy language "call subroutine" how to implement in Delphi?

Time:09-20

Easy language "call subroutine" how to implement in Delphi?

In the easy explanation:
Call subroutine call format: type> English name: CallFunction
Stdcall way (i.e. WINAPI or Pascal) to invoke the specified subroutine (subroutine pointer, or address of a subroutine) and retrieve call subroutine return values, support for any number of parameters, the parameters of support except byte set all other basic data types, call subroutine before, you need to clearly know its parameter types and the number of parameters, and returns a value type, the command returns "true," said only call not out of the abnormal situation in the process, does not mean the called subroutines execution is successful, the command for the senior command, the command parameter last parameter in the table can be repeated to add,
Parameter & lt; 1> For the name of "subroutine pointer or subroutine address," type "universal (all)", tip: before the name of the subroutine to add "& amp;" Can get the subroutine "subroutine pointer", such as "& amp; Subroutine 1 "is" 1 "subroutine subroutine pointer; Subroutine address through this repository "take subroutine address ()" command to get, "to the integer (& amp; Subroutine (1) "the returned and execution of subprogram 1 address, also can through the Windows API function" GetProcAddress call () "to obtain, or by an external program passed,
Parameter & lt; 2> The name of the reserved for "parameters", type of "universal (all)", can be omitted,
Parameter & lt; 3> As the "return value", the name of the type of "universal (all)", can be omitted, providing parameter data can only provide variables, the parameters used to receive after the subroutine is called return values; If the subroutine has no return value or do not need to receive the return value, please omit this parameter, provide the parameters, please be sure to provide accurate data types, otherwise the result may be incorrect,
Parameter & lt; 4> As the "parameters", the name of the type of "universal (all)", can be omitted, this parameter value is passed as a parameter to call subroutine, if there are no parameters corresponding subroutine, please omit this parameter; If there are multiple parameters corresponding subroutine, please repeat it to provide the parameter, please be sure to provide accurate parameter types and the number of parameters, otherwise the consequence is unpredictable.

CodePudding user response:

By getting a procedure or function pointer, invoke this command you can run the procedure or function.
For example:

Procedure ceshi.
The begin
Showmessage (' running ')
end;

Call subroutine (@ ceshi);

So convenient later function in the DLL run EXE program!

CodePudding user response:

Delphi call subroutine directly write subroutines in the name, this is to say how easy language called Delphi subroutine,

CodePudding user response:

No, I am a such idea, EXE itself subroutine address pointer passed to DLL parameters, DLL directly run the address pointer, is running the subroutine

CodePudding user response:

refer to the second floor santiaodahan response:
call subroutine directly write subroutines in Delphi, how to call this is trying to say is easy language Delphi subroutine,


No, I am a such idea, EXE itself subroutine address pointer passed to DLL parameters, DLL directly run the address pointer, is running the subroutine

CodePudding user response:

reference 4 floor qq_25574441 response:
Quote: refer to the second floor santiaodahan response:

Delphi call subroutine directly write subroutines in the name, this is to say how easy language called Delphi subroutine,

No, I am a such idea, EXE itself subroutine address pointer passed to DLL parameters, DLL directly run the address pointer, that is, to run the subroutine

Is a callback, Delphi,
  • Related