在编写的DLL中,一个类中有这样一个声明:
protected
    function  GetConnectionString: String;virtual;abstract;   //得到连接字符串
    procedure SetConnectionString(const Value: String);virtual;abstract;//设置连接字符串published    
    property ConnectionString: String read GetConnectionString write SetConnectionString;
因为String为Delphi的类型,在别处无法使用,所以想换成Pchar,但我不知道怎么处理,如果只是简单地把String变成Pchar,则报错: 
[Error] UIDBLink.pas(33): Published property 'ConnectionString' cannot be of type POINTER
不知道这是为什么,又知道的请帮帮忙,指点指点小弟.

解决方案 »

  1.   

    最好将GetConnectionString放到主程序中,作参数传到DLL中
      

  2.   

    最好不要用STRING,用CHAR比较好
      

  3.   

    pchar(s)
      // s:string;
      

  4.   

    在DLL中传递字符串以及动态数组必须引用 ShareMem 单元 而且必须加在第一个位置。。
     uses
      ShareMem,
      SysUtils,
      Classes;
      

  5.   

    我也遇到过类似问题,一般都是用pchar,上次的问题还没有解决,期待中
      

  6.   

    最好不要用String类型,如果要用的话还是转换一下比较好(PChar)
      

  7.   

    请问转换是在DLL里面转换呢?还是在传入/传出值的时候转换呢?