unit DataInterface;
interface
uses InvokeRegistry, Types, XSBuiltIns;
type// Namespace : SendFinishInt:SendFinishInt
// 名称:购药明细清单传输完成信息
// ************************************************************************ //
SendFinishInt = class(TRemotable)
private
FbatchNo:WideString;
FfinishFlag: WideString; 
FreplyReceiveCount:WideString;
FserialNo:WideString; 
published
property batchNo:WideString read FbatchNo write FbatchNo;
property finishFlag:WideString read FfinishFlag write FfinishFlag;
property replyReceiveCount: WideString read FreplyReceiveCount write FreplyReceiveCount;
property serialNo:WideString read FserialNo write FserialNo;
end;
function SendFinish(const mSendFinishInt: SendFinishInt): FinishReplyInfo; stdcall;我在C#代码里该如何声明参数,以及调用SendFinish方法获取它的返回值呢?分数不多 ,还请各位高手多指教!

解决方案 »

  1.   

    function SendFinish(const mSendFinishInt: SendFinishInt): FinishReplyInfo; stdcall;
    SendFinishInt = class(TRemotable)你可以看到SendFinishInt参数是一个TRemotable类型,所以你要首先在C#中定义一个对应的类型,然后在调用时,传入这样的一个参数,另外,该函数的返回值是FinishReplyInfo类型,你需要找找看该类型的定义。
      

  2.   

    TRemotable
    指什么啊,那个DLL 里面全都是
    CertifyInt = class(TRemotable)
    之类的。
    这个TRemotable 是不是类型C#里的class?FinishReplyInfo
    这个在
    // Namespace : FinishReplyInfo:FinishReplyInfo出现过,但是具体对应C#中的什么我还是很模糊
      

  3.   

    SendFinishInt是VCL中的类,在你的c#代码中,无法找到可以与此对照的类型,楼主放弃这样的操作把
    FinishReplyInfo具体定义不清楚,如果是VCL类,也不成
      

  4.   

    即时delphi写的exe调用此dll,也需要use borlandmm 内存管理单元,否则也会出现不可预见的问题。
    所以请修改dll中的导出函数,尽量使用C中定义的类型作为参数及返回值定义
      

  5.   

    合作公司提供了DLL,我们无法对其更改,但是我就是想知道怎么实现,我想Deliph中的复杂类型在C#里肯定也有对应的实现吧。
      

  6.   

    我对Deliph一点都不了解,use borlandmm 是什么都不知道哦
      

  7.   

    判定,此dll只能由delphi VCL程序调用,c#调用存在问题
      

  8.   

    use borlandmm 
    是引用delphi中共享内存管理器,只需要uses InvokeRegistry, Types, XSBuiltIns,BorlandMM;就行了;
    问题是delphi中的类,他在内存中的结构是你无法得知的(当然可以在delphi中new一个,找到内存开始和结束地址,然后在你C#程序中使用byte[] 定义一篇缓冲区,找到所有的属性和默认值,然后也填写上去,即时这样你也无法得知TObject类中方法的指针,因为这些是在vcl中定义的,你用C#是得不到的【加载带有vcl的dll获取这些方法的地址
    问题还有很多,用c#调用这样的引出函数就放弃把,直接改用delphi做接口程序把