Autor Beitrag
digiwebtal.de
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

XP
D5 Prof
BeitragVerfasst: Do 27.01.05 16:14 
Hi

Wie kann ich in einem DLL-Projekt auf Variablen außerhalb ihrer UNIT zugreifen (ich hab in meinem DLL-Projekt eine UNIT mit den Hauptfunktionen und der Parametrierung [dies sind auch die ExpotFunktionen], zusätzlich habe ich noch ein DatanModul das einen Timer enthält der... Aber ich habe keinen Zugriff von der UNIT auf den Timer; auch nicht mit
ausblenden Delphi-Quelltext
1:
DatenModul1.Timer.Interval := 2500;					


Das alles funktionier in einer normalen Anwendung... (So hab' ich auch die Unit und Das Datenmodul erstellt)

Was ist falsch? Hier ein Test der das Probleme auch aufzeigt:

ausblenden Test_DLL
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
library Test_DLL;

uses
  SysUtils,
  Classes,
  Forms,
  ZusatzUnit1 in 'ZusatzUnit1.pas';

{$R *.RES}

var
  i : integer = 15;

procedure test; export;
begin
  i:=99;
end;

exports
  test index 1;

begin
  i := 0;
end.


ausblenden ZusatzUnit1
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
unit ZusatzUnit1;

interface

implementation
  procedure in_unit1;
  begin
    i:=11; // Wie komm ich an die Variable ais Test_DLL...?
  end;

begin
  in_unit1;
end.


Wer kann mir bei meinem DLL-Problem weiterhelfen...

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 27.01.05 20:07 
Ich bezweifel, dass Du das in einer regulären Anwendung gemacht hast, da du eine DPR-File nicht un die Uses eintragen kannst. Lager ie Variable I in deine Unit aus und dann sollte das gehen.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
digiwebtal.de Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

XP
D5 Prof
BeitragVerfasst: Do 27.01.05 20:45 
Hab ich auch nicht, die Funktinalität ist nur im DatenModul und in der Unit. Wie im ersten Teil beschrieben.
Mein Hauptproblem ist nich die Variable 'i', wie unten im Bsp., sondern das obere...
In einer Anwendung kann ich von der Unit auf das Datenmodul zugreifen...
Wenn ich das gleiche in einer DLL mache, beschwert sich der Compiller nicht, aber an dem Punkt, wo die Unit versucht auf das Datenmodul zu zugreifen, kommt eine Schutzverletzung raus... (das gleiche gilt für Variablen im Datenmodul oder umgekehrt)

Ach so "VerUsed" sind die beiden.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Do 27.01.05 22:22 
Hast Du beachtet, dass Du das Datenmodul erst initialisieren musst?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
digiwebtal.de Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

XP
D5 Prof
BeitragVerfasst: Sa 29.01.05 22:10 
Aaahh!!! :D
Jetzt funst's! Aber beim beenden kommen jetzt die Fehlermeldungen...

DatenModul.Destroy oder Free hab ich schon als letzten Aufruf in der DLL versucht... bringt aber nichts :(

Irgend was mit 'WSAStartup not yet performed' ; 'Unbekannter Softwarefehler'; 'Der Vorgand RAED... konnte nicht'; 'Runntime Error 216 at...'

Der Fehler 'Vorgand READ...' tritt nicht auf wenn vorher DatenModul.Destroy aufgerufen wurde... ...aber die Anderen!

H I L F E :?!?: :puke: :roll:

P.S.
ohne Create für das DatenModule gibt's keine Fehlermelungen beim Beenden (natürlich nur wenn keine Funktionen aus der DLL aufgerufn wurden...)