如果你注册了该dll,并且正确的引用了dll文件,调用她应该是不会出错

解决方案 »

  1.   

    好象是您的dll有问题,
    好象delphi生成的dll
    If you want your DLL to be available to applications written in other languages, it抯 safest to specify stdcall in the declarations of exported functions. Other languages may not support Object Pascal抯 default register calling convention.
    您可以看一下你的delphi技术文档中的writing dll 部分。
      

  2.   

    好象是您的dll有问题,
    好象delphi生成的dll
    If you want your DLL to be available to applications written in other languages, it抯 safest to specify stdcall in the declarations of exported functions. Other languages may not support Object Pascal抯 default register calling convention.
    您可以看一下你的delphi技术文档中的writing dll 部分。
      

  3.   

    1、据我所知,如果DLL中有FROM他不能出现在AUTO-CREATED中。
    2、要么缺少一个BORLNDMM.DLL文件,调用时如果要传递字符串为参数,就要用它。
    你可以试一试。
      

  4.   

    输出函数要加上 stdcall, 这样调用Dll输出函数的时候才不会有问题
      

  5.   

    fly_xyz,BORLNDMM.DLL 如何使用?我是初学能讲详细一点儿吗?我把代码简化了一下,请各位帮我看一下吧:
    unit main;interfaceuses
      forms,Windows,Db, ADODB, Graphics, Classes, Controls,
       StdCtrls, ExtCtrls,ReportControl;
    type
      TfrmRepView = class(TForm)
        ReportRunTime1: TReportRunTime;
        Label1: TLabel;
        Image1: TImage;
        ADOQuery1: TADOQuery;
        DataSource1: TDataSource;
        procedure FormActivate(Sender: TObject);
        procedure FormPaint(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private  public  end;var
      frmRepView: TfrmRepView;
      ADOConn:WideString;
      ADOSQL:String;
    function cRepView (conn:PChar;SQL:PChar):Boolean;stdcall;
    implementation{$R *.DFM}function cRepView (conn:PChar;SQL:PChar):Boolean;begin
      ADOConn:= conn;
      ADOSQL:=SQL;
      frmRepView:=TfrmRepView.Create(nil);
      try
         Result:=(frmRepView.ShowModal=mrOK);
      finally
        frmRepView.Free;
      end;
    end;procedure TfrmRepView.FormActivate(Sender: TObject);
    begin
      Application.ProcessMessages;
      ReportRunTime1.SetDataset('d1',ADOQuery1);
      ReportRunTime1.printpreview(true);
    end;
    procedure TfrmRepView.FormPaint(Sender: TObject);
    begin
       close;
    end;procedure TfrmRepView.FormCreate(Sender: TObject);
    begin
      with ADOQuery1 do
        begin
          SQL.Clear;
          Close;
          ConnectionString:= ADOConn;
          SQL.Text:= ADOSQL;
          ADOQuery1.Open;
        end;
        With ReportRunTime1 Do
          begin
            setdataset('d1',ADOQuery1);
            reportfile:='c:\temp\meitong.ept';
            enableedit:=true;
          end;
    end;
      

  6.   

    在VB中调用时总是提示“无效的连接或连接字符串”,然后出现DLL中的窗体及另一个提示:“ADOQuery1 不能在一个已关闭的数据集上执行该操作”后退出。
      

  7.   

    你查一下VB中传入的字符串正确吗?看d代码好象没有问题。
      

  8.   

    你定义的是pchar类型
    在vb中的调用正确吗?
      

  9.   

    我在VB中是这样调用的:
    '声名部分
    Private Declare Function cRepView Lib "cRepView.dll" (ByVal conn As String, ByVal SQL As String)'调用
    Call cRepView("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\nanwei.mdb;Persist Security Info=False", _
              "Select * From aa")
      

  10.   

    delhpi的DLL中尽量不要使用string变量.改用pchar.
      

  11.   

    是我自己不小心,在VB中的声明错了,应该是:
    Private Declare Function cRepView Lib "cRepView.dll" (ByVal conn As String, ByVal SQL As String) AS BOOLEAN