Autor Beitrag
Unknown
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 184

Win XP
Delphi 7
BeitragVerfasst: Do 20.03.08 17:13 
Hallo,

ich habe hier eine ganz einfache Frage, schaffe sie aber nicht zu lösen.
Und zwar hab ich folgende DLL:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
library Project1;

uses
  SysUtils,
  Classes;

{$R *.RES}

function addiere(zahl1, zahl2: integer): integer; stdcall;
begin
  result := zahl1+zahl2;
end;

exports
  addiere;

begin

end.


Und im meinem Prog

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
unit Unit1;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;
function addiere(zahl1, zahl2: integer): integer; external 'project1.dll';
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
showmessage(inttostr(addiere(1,1)));
end;

end.



Und dann wenn ich starte kommt 5575156 als Show message und dann so eon Read Fehler, wieso ?


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Do 20.03.2008 um 19:50
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 20.03.08 17:26 
In der DLL benutzt du stdcall, im Programm aber nicht. Und damit sind die Aufrufe inkompatibel.