SDL2-for-Pascal icon indicating copy to clipboard operation
SDL2-for-Pascal copied to clipboard

Major review of sdlstdinc.inc (from SDL_stdinc.h) necessary

Open Free-Pascal-meets-SDL-Website opened this issue 3 years ago • 2 comments

The C header file SDL_stdinc.h contains a lot of functions, types and features which are not found in the corresponding sdlstdinc.inc.

A major review of this file is necessary:

  • find defines/types/functions which are potentially useful for Pascal programmers, add them
  • e. g. math functions

I've been updating some of the other .inc files and some of original .h files contain macros / inline functions that make use of stuff declared in SDL_stdinc.h. I'm wondering how to approach this.

  • A) Wherever possible, use FPC's built-in functions, instead. If not possible, declare the SDL functions in sdl2.pas in the implementation section, so they're not exposed to the user.

  • B) Declare the SDL functions as usual inside sdlstdinc.h and just live with the fact that there's only a select few of them declared.

  • C) Go all-in and try to translate as much of the "SDL libc" functions as possible.

suve avatar Nov 20 '22 13:11 suve

A) - In certain cases A) may be suitable, if compatibility is not affected. A hinting FIXME-comment should note about the used functions.

B) - I think this is the best option, because we want our units to be as Delphi compatible as possible, which is not guaranteed for option A). Also, some compiler functions may need additional units which increase dependencies, which is undesirable.

C) - We do not necessarily need all the "SDL libc" functions, so we do not need to waste time in translating and maintaining them.

What do you think? @suve