Autor Beitrag
beljo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Mi 26.04.06 08:41 
Hi Leute,
Mir fällt kein neuer Titel ein weil die Dll's es mir angetan haben.
Hier meine neue Herrausforderung.
Ich habe hier eine funktion minus geschrieben.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
UNIT variable;

INTERFACE
{USES
DOS,CRT}

function minus(a,b:real):real;stdcall;
...
IMPLEMENTATION
function minus(a,b:Real):Real;stdcall;
begin
 result:=a-b;
end;
END.

Hier binde ich sie in eine Dll ein
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:
library rechnen;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }


uses
  SysUtils,variable,
  Classes;


{$R *.RES}

function minus(a,b:Real):Real;stdcall;



  exports
  minus;




begin
end.

Es wird folgende Fehlermeldung angezeigt:[Error] rechnen.dpr(25): EXPORTS allowed only at global scope
Als ich die Function minus in der Dll implementiert hatte funzte es. Aber es muss doch auch so möglich sein.
Hoffe Ihr könnt mir helfen
beljo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Mi 26.04.06 08:53 
ich habe den Fehler gefunden.
In der library hatte ich die Funktion Minus nochmals aufgeführt was falsch ist.
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:
library rechnen;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }


uses
  SysUtils,variable,
  Classes;


{$R *.RES}



  exports
  minus;




begin
end.

So funzt es.