把两处function cre():boolean;far;export;中的far改为stdcall

解决方案 »

  1.   

    在DLL中这样声明试试:
    function cre(): Boolean; stdcall;exports
      cre;implementation
    ...在引用的时候不用声明了,只要在Uses中加上其单元即可。
      

  2.   

    看到一个例子,不知道有没有帮助?看一下吧。是转载的。
    1.设计一个新项目,在其中包含的单元中声名一个供外部程序调用的过程或函数。
       这些和您原来写普通程序都一样。
    2.不一样的是:您需要在单元程序的接口部分声名的函数或过程的后面增加这样的关键字:EXPORT;
    3.修改项目的代码,1.改 program为library,2.改forms为sharemem,
    3在USES后增加EXPORTS关键字,关键字后是调用的过程和函数名,一般为:
        USES
         EXPORTS
          XXXXX;
        {$R *.RES}
    4.删除项目中BEGIN 、END之间的代码。
    编译项目,就可以生成一个扩展名为DLL的动态连接库。调用动态连接库的方法刚好同制作对应,大体分为下列几点:
    1.在单元程序的接口部分声明外部过程,形式参数必须和设计的动态连接库相同。
    Procedure  xxxxxx(var xxxx:xxx ;………);far;external 'xxxxxxx';
    2.在单元程序中,您可以象使用函数一样使用外部单元,编写子过程和函数。
    3.项目文件中,增加SHAREMEM到USES单元,实现内存共享。
      

  3.   

    欢迎访问 http://playyuer.to263.net
    VB、PB、Delphi 联合编程Delphi
    Unit1 代码:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    begin
    MessageDlg('This is a Delphi MessageDlg !',mtInformation,[mbOK],0);
    end;
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    self.Caption:='This is a Delphi Modal Form !';
    self.Button1.Caption:='This is a Delphi Button !';
    end;end.==========================
    VB call Delphi Dll code:
    '一定要声明为 Long,虽然在 Delphi Dll 定义的是 Procedure (过程)
    Private Declare Function ShowDelphiFormModal Lib "..\..\Project1.dll" () As Long
    Private Sub Command1_Click()
    ShowDelphiFormModal
    End Sub
    ==================
    PB call Delphi Dll Code:
    //'一定要声明为 Long,虽然在 Delphi Dll 定义的是 Procedure (过程)
    FUNCTION long ShowDelphiFormModal () LIBRARY "..\..\Project1.dll"
    ...
    ShowDelphiFormModal()
      

  4.   

    应该是 
    欢迎访问 http://simideal.top263.net 
    VB、PB、Delphi 联合编程