调用vc做的dll的问题,接口函数中的参数和返回值都有char和char *类型,请问在delphi中应该怎样定义和应用这些类型??
比如下面两个接口函数:
extern "C" bool _stdcall funt1(jgt_ & jgt); //返回值给jgt_,成功则返回true
extern "C" bool _stdcall funt2(char * fh,char * cs); //参数fh,返回值cs
其中jgt的定义:
typedef struct
{
char cs [50] ;
}jgt;我的做法是:
1,函数定义如下:
funt1(jgt_:jgt):boolean;stdcall;
funt2(fh:pchar;cs:pchar):boolean;stdcall;
其中jgt定义:
type
jgt = packed record
sj: array[0..50] of Char;
end;
2,如果上面定义不错的话,应用的问题有如下两点:
a:怎么把jgt中返回的值转换成string类型?
b:pchar类型的值怎么转换成string类型?
最有有个例子哦~~
比如下面两个接口函数:
extern "C" bool _stdcall funt1(jgt_ & jgt); //返回值给jgt_,成功则返回true
extern "C" bool _stdcall funt2(char * fh,char * cs); //参数fh,返回值cs
其中jgt的定义:
typedef struct
{
char cs [50] ;
}jgt;我的做法是:
1,函数定义如下:
funt1(jgt_:jgt):boolean;stdcall;
funt2(fh:pchar;cs:pchar):boolean;stdcall;
其中jgt定义:
type
jgt = packed record
sj: array[0..50] of Char;
end;
2,如果上面定义不错的话,应用的问题有如下两点:
a:怎么把jgt中返回的值转换成string类型?
b:pchar类型的值怎么转换成string类型?
最有有个例子哦~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货