Autor Beitrag
R4Y
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Mi 23.12.09 22:34 
Hallo,
ich habe seid langer zeit mal wieder ein Problem.
Ich verusche grad ein SDK nach Delphi zu portieren.
Nun scheitere ich an einer Struct.

ausblenden Quelltext
1:
2:
3:
4:
struct TS3Functions
{
   unsigned int (*getPlaybackDeviceList)(int modeID, char**** result);
}


nun weiß ich nicht, wie ich diese zeile nach Delphi umschreiben kann.
Wenn mir da jemand helfen könnte, wäre das super.

grüße
Maurice


Zuletzt bearbeitet von R4Y am So 27.12.09 13:41, insgesamt 1-mal bearbeitet
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 24.12.09 00:01 
user profile iconR4Y hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden C#-Quelltext
1:
2:
3:
4:
struct TS3Functions
{
   unsigned int (*getPlaybackDeviceList)(int modeID, char**** result);
}


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
type
    PPChar = ^PChar;
    PPPChar = ^PPChar;
    PPPPChar = ^PPPChar;

    TPlaybackDeviceListFunc = function (modeID: Integer; Result: PPPPChar): DWORD; stdcall;

    TS3Functions = record
        getPlaybackDeviceList: TPlaybackDeviceListFunc;
    end;


Zwecks Aufrufkonvention ggf. mal schauen, dürft aber stdcall sein. Ansonsten cdecl probieren.

_________________
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.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 24.12.09 05:14 
eine kleine frage dazu, was bringt sich ein 3-facher Pointer auf nen Character-String? (wenn ichs richtig interpretiert habe)

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Do 24.12.09 12:18 
super danke das sieht doch hilfreich aus :)

aber wäre das nicht eigentlich
ausblenden Quelltext
1:
  PlaybackDeviceListFunc:^TPlaybackDeviceListFunc;					


wegen dem pointer?

@elundril
so wie ich das sehe ist das ein 3D array auf eine StringList .. wozu auch immer ^^
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 24.12.09 13:34 
user profile iconelundril hat folgendes geschrieben Zum zitierten Posting springen:
eine kleine frage dazu, was bringt sich ein 3-facher Pointer auf nen Character-String? (wenn ichs richtig interpretiert habe)

lg elundril

In C und C++ sind Arrays und Pointer analog. Von daher kann man das entweder als Pointer übersetzen, oder als Array. Rein aus Portabilitätsgründen sollte man aber für andere Programmiersprachen i.d.R. die Pointer-Version vorziehen.

user profile iconR4Y hat folgendes geschrieben Zum zitierten Posting springen:
super danke das sieht doch hilfreich aus :)

aber wäre das nicht eigentlich
ausblenden Quelltext
1:
  PlaybackDeviceListFunc:^TPlaybackDeviceListFunc;					


wegen dem pointer?

Nein. In C ist void (name *) (void); die generelle Angabe für einen Funktionszeiger. Ohne den Stern wäre es nämlich eine Funktionsdeklaration, was logisch wird, wenn man weiß, dass in C innerhalb eines Records Funktionen supported werden (wozu auch immer man das braucht).

In Delphi wird bereits anhand der Syntax klar, dass keine Funktionsdeklaration gemeint sein kann, weshalb hier die Angabe eine expliziten Pointers notwendig ist: Vielmehr ist der Zeiger bereits implizit in der Typdeklaration enthalten.

user profile iconR4Y hat folgendes geschrieben Zum zitierten Posting springen:
@elundril
so wie ich das sehe ist das ein 3D array auf eine StringList .. wozu auch immer ^^

Korrekt. Terminiert durch je einen Nullzeiger i.d.R. Sei denn, du hast da vorgegebene Konstanten für einzelnen Dimensionen.

_________________
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.
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: So 27.12.09 13:43 
ich hab da nochmal ne frage ^^

wie übersetzt man einen enum ohne namen?

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
enum {
  CODEC_SPEEX_NARROWBAND = 0,   //mono, 16bit,  8kHz, bitrate dependant on the quality setting
  CODEC_SPEEX_WIDEBAND,         //mono, 16bit, 16kHz, bitrate dependant on the quality setting
  CODEC_SPEEX_ULTRAWIDEBAND,    //mono, 16bit, 32kHz, bitrate dependant on the quality setting
  CODEC_CELT_MONO,              //mono, 16bit, 48kHz, bitrate dependant on the quality setting
  CODEC_DUMMY_MONO,             //mono, 16bit, 48kHz, no compression (=> bitrate == 93.75 KiB/s!)
};


enums mit namen sind ja kein problem

ausblenden Delphi-Quelltext
1:
type irgendwas = (a,b,c);					


nur was ist, wenn da kein name steht?

grüße
Maurice
finalizat0r
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 24
Erhaltene Danke: 1



BeitragVerfasst: So 27.12.09 15:38 
Dann musst du dem Enum bzw. dem Type einen Namen geben! Ich hätte das so gemacht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  TS3CODECS = (
    CODEC_SPEEX_NARROWBAND = 0,   //mono, 16bit,  8kHz, bitrate dependant on the quality setting
    CODEC_SPEEX_WIDEBAND,         //mono, 16bit, 16kHz, bitrate dependant on the quality setting
    CODEC_SPEEX_ULTRAWIDEBAND,    //mono, 16bit, 32kHz, bitrate dependant on the quality setting
    CODEC_CELT_MONO,              //mono, 16bit, 48kHz, bitrate dependant on the quality setting
    CODEC_DUMMY_MONO              //mono, 16bit, 48kHz, no compression (=> bitrate == 93.75 KiB/s!)
  );


Ich hab schon unzählige Programm für TeamSpeak 2 Programmiert (Viewer, Admin Tools etc) außer fürs SDK. Wenn du willst kriegst du die (Mit Delphi 2006 Compiliert).
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: So 27.12.09 21:11 
ich übersetze mir ja das gesammte sdk nach Delphi ^^
nur ich kann dem enum ja nicht einfach einen namen geben.
was mich auch viel mehr interessiert, was macht ein enum ohne namen in c++?
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 28.12.09 12:07 
warum kannst du einem Enum keinen Namen geben? der Name dient doch afaik eh nur den Programmieren damit die das Ding irgendwie ansprechen können und is dem Programmcode dann eh schnuppe?

lg elundril

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
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: Mo 28.12.09 12:13 
Enums ohne Namen werden in C(++) oft als Ersatz für Konstanten eingesetzt.

Ansonsten halt wie oben beschrieben.

_________________
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.
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Mo 28.12.09 13:53 
okay dann werde ich sie einfach als konstante deklarieren.
danke ;)
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Sa 02.01.10 04:02 
ich habe jetzt das sdk komplett compilierfähig nach Delphi übersetzt.
allerdings schmiert jetzt TeamSpeak ab beim laden des plugins ^^

vllt kann hier jmd drüberschauen und mir sagen was ich beim portieren falsch gemacht habe.

grüße
Maurice
Einloggen, um Attachments anzusehen!
Astat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 75
Erhaltene Danke: 1

Windows 2000
D6, D7, D2007, Lazarus
BeitragVerfasst: Sa 02.01.10 07:08 
user profile iconR4Y hat folgendes geschrieben Zum zitierten Posting springen:

allerdings schmiert jetzt TeamSpeak ab beim laden des plugins ^^
vllt kann hier jmd drüberschauen und mir sagen was ich beim portieren falsch gemacht habe.


Hallo R4Y, was sagt denn der Debuger und Windebug, wenn Du die DLL startest (Host Teamviewer)?
Wo in Welcher Unit und Zeile krachts denn?

Die Pointer auf Pointer auf Pointer auf PChar kommen mir sehr merkwürdig vor?

PPPChar = ^PPChar;
PPPPChar = ^PPPChar;

Habe allerdings SDK noch nicht gecheckt, möchte auf Deine Debugantwort warten? "g"

lg. Astat
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Sa 02.01.10 14:13 
das ist ja das, was mich nervt.
teamspeak erstelllt keinen crashdump oder gibt debug infos aus.
es schließt sich einfach.

mit nem debugger kommt ich auch net ran :/
Astat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 75
Erhaltene Danke: 1

Windows 2000
D6, D7, D2007, Lazarus
BeitragVerfasst: Sa 02.01.10 17:45 
user profile iconR4Y hat folgendes geschrieben Zum zitierten Posting springen:
das ist ja das, was mich nervt.
teamspeak erstelllt keinen crashdump oder gibt debug infos aus.
es schließt sich einfach.

mit nem debugger kommt ich auch net ran :/


Hallo R4Y, habe Windebug von MS gemeint.

www.microsoft.com/wh...bugging/default.mspx
www.microsoft.com/wh...ng/installx86.mspx#a

Sollte zumindest das Modul und Ladezustand liefern.

lg. Astat
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Di 05.01.10 05:24 
ich verstehe nicht ganz, wie ich die programme anwenden muss ^^