AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Dll und Variablen-Scope

Ein Thema von Sämy · begonnen am 29. Nov 2007 · letzter Beitrag vom 29. Nov 2007
 
Sämy

Registriert seit: 4. Nov 2004
Ort: Basel (CH)
76 Beiträge
 
Delphi 2007 Professional
 
#1

Dll und Variablen-Scope

  Alt 29. Nov 2007, 09:49
Hallo

Ich habe eine Klasse, die ich als Singleton(nur eine Instanz) definiere:
Delphi-Quellcode:
type
  TPluginManager = class
  public
    class function getInstance: TPluginManager;
  end;

var
  instance: TPluginManager;

implementation

class function TPluginManager.getInstance: TPluginManager;
begin
  if not Assigned(instance) then
    instance := TPluginManager.Create;
  Result := instance;
end;
Wenn ich nun also TPluginManager.getInstance aufrufe, so bekomme ich dessen Instanz zurück.
Ich arbeite jedoch mit Dll's und wenn ich von dort aus TPluginManager.getInstance aufrufe, erhalte ich nicht mehr die in der Applikation erzeugte Instanz, sondern eine neue wird erstellt.
Wie kann ich dieses Problem umgehen?

Besten Dank!
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:18 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz