Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 19.09.05 19:17 
Ich hab ne DLL und die will ick mein App einbinden:

ausblenden Delphi-Quelltext
1:
 function saveHashes : boolean;   external 'Cryptix.dll';  stdcall;					


Aber das wird erst gar nich compiliert;

[Fehler] main.pas(522): Felddefinition nicht erlaubt nach Methoden oder Eigenschaften

Was muss man denn schreiben um eine DLL einzubinden?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Mo 19.09.05 19:20 
ausblenden Delphi-Quelltext
1:
function saveHashes : boolean; stdcall; external 'Cryptix.dll';					

_________________
wer andern eine grube gräbt hat ein grubengrabgerät
- oder einfach zu viel zeit
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Mo 19.09.05 21:13 

_________________
Ciao, Sprint.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.09.05 08:36 
user profile iconKoller hat folgendes geschrieben:
[Fehler] main.pas(522): Felddefinition nicht erlaubt nach Methoden oder Eigenschaften

Kann es sein, dass die Deklaration bei dir in einer Klasse steht?
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 20.09.05 10:27 
Das stdcall an die andere Stelle schieben geht auch nicht. Hab ich schon alles ausprobiert. Und auf die Frage ob das in einer Klasse steht kann ich nicht beantworten.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
MisterBum
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 107



BeitragVerfasst: Di 20.09.05 10:41 
So mache ich es immer und es funktioniert:

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:
unit Main;

interface

uses ...;

type
  TFormMain = class(TForm)
   ...

  private
    { Private-Deklarationen }
    ...

  public
    { Public-Deklarationen }
    ...
  end;

var
  FormMain: TFormMain;

implementation

uses ...

{$R *.dfm}

{ ------ DLL-Funktionen ------ }

function DLLAufruf(Modul: integer): boolean; stdcall; external 'DLLDatei.dll';

function NochEinDLLAufruf(Modul: integer; MyHandle: HWND): boolean; stdcall; external 'NocheineDLLDatei.dll';

{ ---------------------------- }


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 20.09.05 10:47 
@Koller: Du hast mir meine Frage nicht beantwortet. Methoden-Deklarationen in einer Klasse dürfen nicht vor den Feldern (Variablen) einer Klasse stehen.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 20.09.05 11:27 
Titel: DLL
ich hab das jetzt hingekriegt.
Ich hab dummerweise die Deklaration bei type hingeschrieben. Jetzt stehts bei implementation und jetzt funzts. Bloß ich hab das mit Strings und Pchar noch nicht hingerkeigt. Arbeite also weiter dran. Trotzdem ist meine Frage beantwortet. Vielen Dank für eure Hilfe! :wink:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot