Home > database >  The value of the string to get double pointer
The value of the string to get double pointer

Time:10-14

Calling a equipment outside the com DLL, such as the function name read (string, number); One of the return character, is a double pointer,
If only ordinary pointer read (ref string, long);
Now double pointer if still use this method to take out the are garbled, consult, how to obtain the double pointer the value of the string,

CodePudding user response:

Reference the try

In call external DLL function, often using a pointer, so in pb how to implement?

See first a DLL function declarations in the documentation:

The Function GetFamInfo (info: pchar, out flag: integer) : pchar; Stdcall;//the flag is a export parameter function return value and the first argument is a pointer type


Pchar is the pointer type in Delphi, so we should how to declare and invoke in pb?

First in pb declare global external functions provides external declaration in the DLL function:

The public function long GetFamInfo (long info, ref int flag) library "nccm_interface. DLL" ALIAS FOR "GetFamInfo
"

Then call in the project:

Long RTN
Int flag
Long famInfo
RTN=GetFamInfo (famInfo, flag)
Sle_1. Text=String (flag)
Sle_2. Text=string (RTN, "address")


Long can be used as a pointer type in pb, as long as a character pointer, you can use the String (long, "address") this method, read long pointer address what really save String, and pay a character variable,



If this doesn't work, it is estimated that use pb is difficult, suggest you use Delphi or c to write a DLL, via the DLL to adjust the double pointer, call your transit in pb DLL

CodePudding user response:

I also used this method, but the is always garbled, depressed ah,

CodePudding user response:

Isn't compile, you try this

Ls_temp=String (long, "address")

Lb_blob=blob (ls_temp)//EncodingUTF16LE! Is the default

Ls_result=string (lb_blob EncodingANSI!)

If not yet, will make a DLL, in another language transfer
  • Related