Ich bin beim Fehlersuchen auf folgendes gestossen, SDL_log gibt es bei SDL3 zweimal. Einmal wird es gebraucht als Log-Info-Ausgabe, das andere mal als Mathefunktion. Einziger feiner Unterschied C-Seitig, Log ist einmal goss und andere mal klein geschrieben.
Aber FPC ruft die falsche Funktion aus.
Code: Alles auswählen
uses
  //  SDL3,
  ctypes;
  {$LinkLib 'SDL3'}
  // Mathe Funktion
  function SDL_log(x: cdouble): cdouble; cdecl; external;
  function SDL_cos(x: cdouble): cdouble; cdecl; external;
  // Log Info Ausgabe
  procedure SDL_Log(fmt: PChar); varargs; cdecl; external;
begin
  WriteLn(SDL_log(12.45));  // geht
  SDL_Log('%ix%i', 123, 456);  // Runtime 207
  SDL_Log('log 1');
  SDL_cos('abc');             // Error: Incompatible type for arg no. 1: Got "Constant String", expected "Double"
  SDL_cos(PChar('abc'));      // Error: Incompatible type for arg no. 1: Got "PChar", expected "Double"
  SDL_cos('%ix%i', 123, 456); // Error: Wrong number of parameters specified for call to "SDL_cos"
end.Als Test habe ich noch SDL_cos versucht, da motzt der Compiler wie erartet, wen ich eine PChar mitgeben will.
Entferne ich die Zeile mit SDL_Log und dem Pchar, motz er wie bei SDL_cos.
Ist dies ein Bug oder ist dies so gewollt ?


 Verein
Verein 
 Links
Links Suche
Suche