Autor Beitrag
stefan1707
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Do 15.03.07 17:37 
Hallo,
ich habe anhand eines Turotorials das Erstellen einer Dll halbwegs nachfollzogen.
Eine Dll habe ich auch erstellen können.
Auf die Dll möchte ich über eine externe Exe zugreifen, leider gibts da eine Fehlermeldung.
Hier der Source der DLL.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
library ECMBerechnung;

uses
  SysUtils,
  Classes,
  MO_Calculate in '..\Module\MO_Calculate.pas',
  Sp_La in '..\Test\Sp_La.pas',
  Untermethode in '..\Test\Untermethode.pas',
  variablen in '..\Test\Variablen.pas',
  
{$R *.res}
exports
//  SetVersion,
//  GetVersions,
 MO_Calculate.DoCalculate,   // DoCalculate ist in der MO_Calculate mit stdcall gekennzeichnet
 MO_Calculate.SetOutputDir;  // SetOutputDir ist in der MO_Calculate mit stdcall gekennzeichnet

begin
end.

Hier meine Exe die ich Ausführen will bei der der Fehler erscheint [Fehler] ec_aufruf.pas(6): Deklaration erwartet, aber 'USES' gefunden
ausblenden volle Höhe 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:
30:
31:
32:
33:
34:
35:
36:
unit ec_aufruf;

interface
 procedure DoCalculate;stdcall;
 procedure SetOutputDir;stdcall;
uses  // hier ist die Fehlermeldung
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure DoCalculate;stdcall;
procedure SetOutputDir;stdcall;
external '..\Main\ECMBerechnung.dll';

procedure TForm1.FormCreate(Sender: TObject);
begin
  SetOutputDir;
  DoCalculate;
end;

end.

vielleicht weis ja jemand woran es liegt.
HelgeLange
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 735
Erhaltene Danke: 6

Windows 7
Delphi7 - Delphi XE
BeitragVerfasst: Do 15.03.07 19:39 
versuch mal, die uses gleich unter die interface-deklaration zu setzen

_________________
"Ich bin bekannt für meine Ironie. Aber auf den Gedanken, im Hafen von New York eine Freiheitsstatue zu errichten, wäre selbst ich nicht gekommen." - George Bernhard Shaw
stefan1707 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Fr 16.03.07 10:35 
Hallo,
nein der Fehler ist nicht behoben.
bitte um weitere Vorschläge.
JDKDelphi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 115
Erhaltene Danke: 22

WIN2000, XP, WIN 7 , UNIX, LINUX
Assembler für (Z8x, 68xxx,R6000,Intel), DELPHI 6 Enterprise, MAGIC eDeveloper V9+V10, C++, C#,VB, .NET, zertifizierter iBOLT-Programmierer
BeitragVerfasst: Fr 16.03.07 20:12 
Titel: DLL
Hallo,

Du musst beide Funktionen der DLL als external deklarieren.. Versuch mal, es ohne relative Pfad zu machen..

Ausserdem.. Erst nach Implementation einfügen..

Etwa so:
Procedure MyDllFunc(..); stdcall; external 'mydll.dll'

Gruss