AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Rückgabe-Pointer PUTF8String aus DLL in String umwandeln?
Thema durchsuchen
Ansicht
Themen-Optionen

Rückgabe-Pointer PUTF8String aus DLL in String umwandeln?

Ein Thema von philipp.hofmann · begonnen am 16. Jan 2020 · letzter Beitrag vom 20. Jan 2020
 
Friedhelm Drecktrah
(Gast)

n/a Beiträge
 
#9

AW: Rückgabe-Pointer PUTF8String aus DLL in String umwandeln?

  Alt 17. Jan 2020, 15:26
Das läuft bei mir:

program SDLDemo;

{$APPTYPE CONSOLE}
{$R *.res}

uses
System.SysUtils;

type
TSdlAudio = class
public
procedure GetAudioDeviceNames();
end;

const
SDL_INIT_TIMER = $00000001;
SDL_INIT_AUDIO = $00000010;
SDL_INIT_VIDEO = $00000020; // SDL_INIT_VIDEO implies SDL_INIT_EVENTS
SDL_INIT_JOYSTICK = $00000200; // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS
SDL_INIT_HAPTIC = $00001000;
SDL_INIT_GAMECONTROLLER = $00002000; // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK
SDL_INIT_EVENTS = $00004000;
SDL_INIT_SENSOR = $00008000;
SDL_INIT_NOPARACHUTE = $00100000; // compatibility; this flag is ignored.

DEVICE_TYPE_OUTPUT = 0;
DEVICE_TYPE_INPUT_CAPTURE = 1;

function SDL_Init(flags: integer): integer; cdecl; external 'SDL2.dll';
function SDL_GetNumAudioDevices(isCapture: integer): integer; cdecl; external 'SDL2.dll';
function SDL_GetAudioDeviceName(index: integer; isCapture: integer): PAnsiChar; cdecl; external 'SDL2.dll';

{ TSdlAudio }

procedure TSdlAudio.GetAudioDeviceNames();
var
initResult: integer;

numDevices: integer;
deviceId: integer;

deviceName: PAnsiChar;
begin
initResult := SDL_Init(SDL_INIT_AUDIO);
Writeln('initResult: ' + initResult.ToString());

numDevices := SDL_GetNumAudioDevices(0);
Writeln('numDevices: ' + numDevices.ToString());

for deviceId := 0 to numDevices - 1 do
begin
deviceName := SDL_GetAudioDeviceName(deviceId, DEVICE_TYPE_OUTPUT);
Writeln('deviceName: ' + deviceName);
end;
end;

var
sdlAudio: TSdlAudio;

begin
try
sdlAudio := TSdlAudio.Create;
sdlAudio.GetAudioDeviceNames();
sdlAudio.Free;

Writeln;
Writeln('Enter drücken...');
ReadLn;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;

end.


Gruß

Geändert von Friedhelm Drecktrah (17. Jan 2020 um 15:56 Uhr)
  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 15:00 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