Home > Back-end >  What do you want to be a DLL can return multiple parameters, how to do?
What do you want to be a DLL can return multiple parameters, how to do?

Time:10-10

The function TestDll (a: pchar; B: pchar; Rtna: pchar; RTNB: pchar) : integer; Stdcall;
The begin

//processing statement
//...

Result:=I;
end;

Exports
TestDll;

The begin
End.

To achieve rtna and RTNB as ginseng, returned to the calling TestDll program, can you tell me how to implement?

CodePudding user response:

language problem?
If the caller is allocated buffer in advance, then you can directly through the pointer manipulation to modify the content of the buffer, the parameters of the function table keep unchanged as they are now,
If is to modify the argument a pointer pointing to directly, you must pass reference, parameter table instead of (a, b: pchar; Var rtna RTNB: pchar)

CodePudding user response:

I am a novice, please do not laugh,

If is to modify the argument a pointer pointing to directly, you must pass reference, parameter table instead of (a, b: pchar; Var rtna RTNB: pchar)

Specific how do you write the following statement?

CodePudding user response:

I don't know you want to do, how can know how are you going to write?

CodePudding user response:

Now that is return a string, can to merge two strings, separated by a delimiter between; Back then according to the separator to open it, so, N strings will be included in a return parameter is returned,

If there is N return parameter type is not consistent, that you can define a first record types, which include anything you want to return, so also ok,

CodePudding user response:

Various options
Returns the structure
Using var/out parameters

CodePudding user response:

Using var/out parameters how to write?

CodePudding user response:

The function TestDll (a: pchar; B: pchar; The out rtna RTNB: pchar) : integer; Stdcall;
The begin

//processing statement
//...

Result:=I;
end;

Exports
TestDll;

The begin
end.

CodePudding user response:

Structure, pointer, can return multiple parameters
  • Related