当前位置: 代码迷 >> PB >> pb 调用 dll 有关问题
  详细解决方案

pb 调用 dll 有关问题

热度:99   发布时间:2016-04-29 06:54:11.0
pb 调用 dll 问题
//c++  extern "C" __declspec(dllexport)bool __stdcall Wirte(char *str_queybrxxsql,
int gsbh, char *author, int blbz, int checklevel) 
//函数申明

function Boolean Wirte(ref string str_queybrxxsql,int  gsbh,ref string author ,int  blbz,int  checklevel) library 'UniEdit.dll' //2.写病历模模式 bool __stdcall Wirte(stu_BaseData *c_basedata) alias for "Wirte;Ansi"

//函数执行

 string ls_queybrxxsqlt,ls_authort
 int li_gsbh,li_BLBZ,li_CheckLevel

  String   ls_dst     
  string   ls_src    
  long   ll_address    

 li_gsbh=1
 li_BLBZ=1
 li_CheckLevel=0

ls_queybrxxsql   =SPACE(100)      
ls_queybrxxsql =  'SELECT * from MZ_LS_GHDJB where BLH =2010988'
 ls_author   =SPACE(100)        
ls_author='1920'

 Wirte( ls_queybrxxsql,li_gsbh, ls_author,li_BLBZ,li_CheckLevel)

//queybrxxsql  ls_author 传入动态库中,只显示取到了一位的值。
queybrxxsql  =S
author=1  
不知是何用原因,pb 9则测试通过。
 

------解决方案--------------------
你用pb10及以上版本时,函数申明后面加上;ansi
------解决方案--------------------
ref string str_queybrxxsql 和 ref string author 分别换为 ref char str_queybrxxsql[] 还有 ref char author[]

取得str_queybrxxsql后,再将它复制给 string 类型的变量,如:
string ls
ls = str_queybrxxsql
  相关解决方案