Пишу программку для КПК на Delphi .NET. Нужно из нее вызвать DLL, собранный на Delphi7. На моем компьютере вызов DLL работает нормально, а на КПК выдает ошибку: 'MissingMethodException'. Вот код тестовой программы: | Код | unit MainForm;
interface
uses {$IFDEF CF_Pluimers} Pluimers.WindowsCE.ClassHelpers, {$ENDIF CF_Pluimers} System.Drawing, System.Collections, System.ComponentModel, System.Windows.Forms, System.Data, System.Runtime.InteropServices, Borland.Vcl.Types, Borland.Vcl.SysUtils;
type frmMain = class(System.Windows.Forms.Form) {$REGION 'Designer Managed Code'} strict private /// <summary> /// Required designer variable. /// </summary> Components: System.ComponentModel.Container; Label1: System.Windows.Forms.Label; Button1: System.Windows.Forms.Button; TextBox1: System.Windows.Forms.TextBox; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> procedure InitializeComponent; procedure Button1_Click(sender: System.Object; e: System.EventArgs); {$ENDREGION} strict protected /// <summary> /// Clean up any resources being used. /// </summary> procedure Dispose(Disposing: Boolean); override; private { Private Declarations } public constructor Create; end;
[assembly: RuntimeRequiredAttribute(TypeOf(frmMain))]
implementation
[DllImport('Project2.dll', EntryPoint = 'MyFunction')] function MyFunction(i:integer):integer; external;
{$AUTOBOX ON}
{$REGION 'Windows Form Designer generated code'} /// <summary> /// Required method for Designer support -- do not modify /// the contents of this method with the code editor. /// </summary> procedure frmMain.InitializeComponent; begin Self.Label1 := System.Windows.Forms.Label.Create; Self.Button1 := System.Windows.Forms.Button.Create; Self.TextBox1 := System.Windows.Forms.TextBox.Create; Self.SuspendLayout; // // Label1 // Self.Label1.Location := System.Drawing.Point.Create(64, 56); Self.Label1.Name := 'Label1'; Self.Label1.TabIndex := 0; Self.Label1.Text := 'Label1'; // // Button1 // Self.Button1.Location := System.Drawing.Point.Create(64, 104); Self.Button1.Name := 'Button1'; Self.Button1.TabIndex := 1; Self.Button1.Text := 'Button1'; Include(Self.Button1.Click, Self.Button1_Click); // // TextBox1 // Self.TextBox1.Location := System.Drawing.Point.Create(72, 152); Self.TextBox1.Name := 'TextBox1'; Self.TextBox1.TabIndex := 2; Self.TextBox1.Text := 'TextBox1'; // // frmMain // Self.AutoScaleBaseSize := System.Drawing.Size.Create(5, 13); Self.ClientSize := System.Drawing.Size.Create(232, 293); Self.Controls.Add(Self.TextBox1); Self.Controls.Add(Self.Button1); Self.Controls.Add(Self.Label1); Self.MinimizeBox := False; Self.Name := 'frmMain'; Self.Text := 'frmMain'; Include(Self.Click, Self.frmMain_Load); Self.ResumeLayout(False); end; {$ENDREGION}
procedure frmMain.Dispose(Disposing: Boolean); begin if Disposing then begin if Components <> nil then Components.Dispose(); end; inherited Dispose(Disposing); end;
constructor frmMain.Create; begin inherited Create; // // Required for Windows Form Designer support // InitializeComponent; // // TODO: Add any constructor code after InitializeComponent call // end;
procedure frmMain.Button1_Click(sender: System.Object; e: System.EventArgs); begin MyFunction(3); end;
end.
|
Это сообщение отредактировал(а) SerGreY - 22.4.2007, 16:43
|