[fpc-pascal]Error 216 with SDL

Holger Peters digitalvertex at gmx.net
Wed Aug 6 20:21:10 CEST 2003


Holger Peters schrieb:

> Hi,
>
> I used SDL4FreePascal under Windows with FreePascal 1.0.6 and it 
> worked fine. Now, I use RedHat 9.0 with FreePascal 1.0.10 and 
> SDL4FreePascal doesn't work.
> When I compile the demos, I get the runtime error 216 at the first 
> SDLcommand.
>
> Is there a solution?
>
>
> Holger 


I tried to debug it via gdb, the first SDL function SDL_Init let's the 
program crash.

Now I tried to write a little include file with some functions, types 
and constants. I want to extend it, with the SDL Functions I need until 
it is complete.

But with this simple instructions, it doesn't work, to.


{$ifdef Linux}
{$LINKLIB pthread}
{$ENDIF}
{General}
const
        SDL_INIT_TIMER          = $00000001;
        SDL_INIT_AUDIO          = $00000010;
        SDL_INIT_VIDEO :Cardinal                = $00000032;
        SDL_INIT_CDROM          = $00000100;
        SDL_INIT_JOYSTICK       = $00000200;
        SDL_INIT_NOPARACHUTE    = $00100000; {Don't catch fatal signals}
        SDL_INIT_EVENTTHREAD    = $01000000; {Not supported on all Os's}
        SDL_INIT_EVERYTHING     = $0000FFFF;
type
        Uint32 = Cardinal;
function SDL_Init(Flags : Uint32) : Integer; cdecl; external 'SDL';
procedure SDL_Quit; cdecl; external 'SDL';
{Video}
{Sound}
{Events}


I've got this constants from the SDL.h on my PC.
It fails with the same error if you use this constants (except 
SDL_INIT_TIMER). But It works fine with values like 1,2,3,4...
The function returns 0, that means that it was succesful 
(SDL-Documentation: Returns -1 on an error or 0 on success.)

I can't undestand the sense.

Holger

PS:

To test this Includefile, I used this program
program testsdl;
{$MODE OBJFPC}
{$MACRO ON}
{$INCLUDE sdlinc.inc}
begin
        WriteLn(SDL_Init(SDL_INIT_VIDEO));
        SDL_Quit;
end.






More information about the fpc-pascal mailing list