Delphi函数
function TestStr(var strValue:pChar):integer;我想用strValue返回参数,在C#中用如下几种方式调用都不行
[ DllImport(....)]
public static extern int TestStr(out string strValue);
.
.
调用:string s="";
TestStr(out s);
错误:未将对象引用为实例
[ DllImport(....)]
public static extern int TestStr(out StringBuild strValue);
.
.
.
调用:StringBuild s=new StringBuild(256);
TestStr(out s);
s变为Null;
请高手讲解
function TestStr(var strValue:pChar):integer;我想用strValue返回参数,在C#中用如下几种方式调用都不行
[ DllImport(....)]
public static extern int TestStr(out string strValue);
.
.
调用:string s="";
TestStr(out s);
错误:未将对象引用为实例
[ DllImport(....)]
public static extern int TestStr(out StringBuild strValue);
.
.
.
调用:StringBuild s=new StringBuild(256);
TestStr(out s);
s变为Null;
请高手讲解
[DllImport(....)]
public static extern int TestStr([MarshalAs(UnmanagedType.LPTStr)]string strValue);
Eastunfail(恶鱼杀手)的方法我也试过,可能是Delphi的数据类型的问题。
你们有没有用Delphi写过Dll,用参数来返回值在其它开发环境中调用成功啊(PB、VC、C#、VB等)。
我写的Dll函数 function TestStr(var strValue:pChar):integer;
在Delphi中能调用成功,能通过参数取到返回值,但是在其它的环境中都不成功。