Usage examples (including MSP_SUCCESS 0) :
const char * params="SSM=1, ent=intp65, aue=speex - wb; 7, auf=audio/L16; Rate=16000 ";
Int ret=MSP_SUCCESS;
Const char * session_id=QTTSSessionBegin (params, & amp; Ret);
If (MSP_SUCCESS!=(ret)
{
Printf (" QTTSSessionBegin failed, the error code is: % d ", ret);
}
Please look at me into the Delphi code where there is a problem, thank you first!
The function QTTSSessionBegin (Params: PChar; ErrorCode: PInteger) : string; Stdcall; External 'MSC. DLL';
Procedure TForm1. Button1Click (Sender: TObject);
Var
SessionStr SessionID: string;
R: PInteger;
A: Integer;
The begin
A:=0;
R:=@ a;
SessionStr:='SSM=1, ent=intp65, aue=speex - wb; 7, auf=audio/L16; Rate=16000 ';
SessionID=QTTSSessionBegin (PChar (SessionStr), r);
ShowMessage (SessionID);
end;
Click for execution to the calling QTTSSessionBegin error: Access violation at address... In the module 'MSC. DLL'. The Write of address...
CodePudding user response:
PChar PAnsiChar insteadCodePudding user response:
Try changing the stdcall to cdecl,Reference:
http://blog.csdn.net/huang_xw/article/details/7524359
CodePudding user response:
Are not these reasons, the question I have tried before, and thank you!There is no master to help me take a look at what's problem?
CodePudding user response:
DLL call other languages, best don't string, use pchar or pansicharThe function QTTSSessionBegin (Params: PChar; ErrorCode: PInteger) : pchar; Stdcall; External 'MSC. DLL';
CodePudding user response:
Used xunfei Delphi version of the DLL, but need to install the N number of software to use, now basically is C DLL,CodePudding user response:
SessionStr: string into SessionStr: array [0.. 255] of the charCodePudding user response:
The problem is still, come to help me,CodePudding user response:
ErrorCode: PInteger to var ErrorCode: integerQTTSSessionBegin (PChar (SessionStr), r) into QTTSSessionBegin (PChar (SessionStr), a)