Autor Beitrag
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 25.04.05 18:24 
ich möchte versuchen, meine Dateien die upgedatet werden sollen, so klein wie möglich zu halten. Das mache ich, indem ich algos, die nie upgedatet werden, in eine dll auslagere, und ich versuche mir u.a. so einige units zu sparen (bsp: shellapi, von der ich eh nur shellexecute benutze.)

Nun will ich in der DLL einen Parameter vom Typ TStringList übergeben, das klappt auch, nur wegen der nötigen unit wird meine DLL dadurch mal kurz doppelt so groß. Kann ich die Klasse TStringList auch selber schreiben bzw bekomme ich deren code irgentwo her? Gibt es andere möglichkeiten, solche Dateien klein zu halten?

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 25.04.05 18:36 
wie wäre es denn mit einem array anstatt einer stringlist?

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mo 25.04.05 21:44 
Kann ich denn TStringList als Parameter an eine funktion übergeben, die einen array of String erwartet?

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 25.04.05 23:46 
Hier eine "Mini StringList" Unit welche ohne zusaetliche Units auskommt.

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:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
UNIT StrList;

INTERFACE

TYPE
  TStrList = CLASS(TObject)
  PRIVATE
    vList  : ARRAY OF STRING;
  PUBLIC
    Count : Integer;
    CONSTRUCTOR Create;
    PROCEDURE   Add(Text:STRING);
    FUNCTION    Strings(Index:Integer) : STRING;
    FUNCTION    Exists(Name: String) : BOOLEAN;
  END;

IMPLEMENTATION

CONSTRUCTOR TStrList.Create;
BEGIN
  Count:=0;
  SetLength(vList,Count+1);
END;

PROCEDURE TStrList.Add(Text:STRING);
BEGIN
  SetLength(vList,Count+1);
  vList[Count]:=Text;
  Inc(Count);
END;

FUNCTION TStrList.Exists(Name: String) : BOOLEAN;
VAR
  I : Integer;
BEGIN
  Result := FALSE;
  FOR I := 0 TO Count-1 DO
    IF Strings(I) = Name THEN Result := TRUE;
END;

FUNCTION TStrList.Strings(Index:Integer) : STRING;
BEGIN
  Result:=vList[Index];
END;

END.
Neidhard von Reuental
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 268

XP
BDS 2006 Prof
BeitragVerfasst: Di 26.04.05 06:25 
wenn du strings zwischen anwendung und dll austauschst haste doch sicher sharemem in den uses stehn. ich würde mir in diesem fall mal gedanken machen wie ich das loswerden könnte.
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 26.04.05 21:50 
sharemem loswerden? wozu - die macht nich SO viel aus. aber die TStringList nervt mich... der code den du da hast - da wird er mir nicht "Inkompatible typen: TStrList und TStringList" bringen? wenn nicht wärs ja nett :D würde mir ne unit ersparen.

@neidhard: Ich will ja nich in der DLL sparen, sondern im Hauptprogramm..

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 26.04.05 21:55 
such mal nach Suche bei Google FASTSHAREMEM ;)

AXMD
JayEff Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 26.04.05 22:12 
Danke, die Fastsharemem hab ich gefunden - hat die dll um 1 KB größer gemacht... ^^ macht aber nix, solange das ding vorteile hat. kann ich mir denn dadurch dei einbindung von Classes sparen? in der ist TStringList deklariert und das ist echt GROSS.

[Fehler] RMCfuncs.dpr(40): Undefinierter Bezeichner: 'TStringList'
dachte ich mir gleich.

naja das ganze ist nicht soooo wichtig...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.